class Demo04
{
public static void main(String[] args)
{
//加法:+两边都为数值类型
System.out.println(1+2);
System.out.println(1+2.0);
//拼接字符串:””+任意类型=””
System.out.println(1+”2″); // =12
System.out.println(“sum=”+(1+2));//从左往右运算 “sum=1″+2=”sum=12”
//- * / 整数/整数=整数 分母不能为0
System.out.println(5-2);//3
System.out.println(5*2);//10
System.out.println(5/(2*1.0));//2 要么就 (1.0*5/2)
System.out.println(5%2); //1
}
}
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/244419.html