public class Dome10 {标签:基本,int,System,long,运算符,println,out From: https://www.cnblogs.com/zzh-study/p/17740242.html
public static void main(String[] args){
//二元运算符
//Ctrl+D :复制当前行到下一行
int a = 10;
int b = 20;
int c = 25;
int d = 25;
System.out.println(a+b);
System.out.println(a-b);
System.out.println(a*b);
System.out.println(a/(double)b);//需要强转,int不能显示小数
long e = 1212312123123L;
int f = 123;
short g = 10;
byte h = 8;
System.out.println(e+f+g+h);//long
System.out.println(f+g+h);//int
System.out.println(g+h);//int
//式子中有long转为long,没有long有int转为int,没有long和int转为int!!!cast:转换!!!
//关系运算符返回的结果; 正确,错误 布尔值
int i = 10;
int j = 20;
int k = 22;
System.out.println(k%i);//取余,模运算
System.out.println(i>j);
System.out.println(i<j);
System.out.println(i==j);
System.out.println(i!=j);
}
}
/*运算符
算术运算符:+,-,*,/,%,++,--
赋值运算符:=
关系运算符:>,<,>==,<==,==,!=,instanceof
逻辑运算符:&&,||,!
(以下三种运算符了解即可)
位运算符:&,|,^,~,>>,<<,>>>
条件运算符?:
扩展赋值运算符:+=,-=,*=,/=
*/