day03
运算符 operator
1.%(取余,模运算) ,> ,< ,== ,!=
关系运算符返回的结果:正确,错误 布尔值
++ – 自增 自减 一元运算符 += -=
2.逻辑运算符
//与(and) 或(or) 非(取反)
boolean a=true;
boolean b=false;
System.out.println("a&&b:"+(a&&b));//逻辑与运算
System.out.println("a||b:"+(a||b));//逻辑或运算
System.out.println("!(a&&b):"+!(a&&b));//非
//短路运算
int c=5;
boolean d=(c<4)&&(c++<4);//c<4已经错了,短路了,后面就不计算了
3.位运算
/* 位运算
A= 0011 1100
B= 0000 1101
--------------------------
A&B 0000 1100
A|B 0011 1101
A^B 0011 0001
~B 1111 0010
2*8=16 <=> 2*2*2*2
<< *2
>> /2
0000 0001 1
0000 0010 2
0000 0100 4
0000 1000 8
0001 0000 16 2<<3==16
*/
4.三元运算符
x?y:z
if x==true,
result=y,otherwise result=z;
5.static