算术运算符
float x = 3+2; // 5 // addition 加
x = 3-2; // 1 // subtraction 减
x = 3*2; // 6 // multiplication 乘
x = 3/2; // 1 // division 除
x = 3%2; // 1 // modulus (division remainder) 余数
Combined assignment operators
int x = 0;
x += 5; // x = x+5;
x -= 5; // x = x-5;
x *= 5; // x = x*5;
x /= 5; // x = x/5;
x %= 5; // x = x%5;
递增和递减运算符
++x; // x += 1
−−x; // x -= 1
++x; // pre-increment
−−x; // pre-decrement
x++; // post-increment
x−−; // post-decrement
x = 5; y = x++; // y=5, x=6
x = 5; y = ++x; // y=6, x=6
比较运算符
boolean x = (2==3); // false // equal to 等
x = (2!=3); // true // not equal to 不等
x = (2>3); // false // greater than 大于
x = (2<3); // true // less than 小于
x = (2>=3); // false // greater than or equal to 大于等于
x = (2<=3); // true // less than or equal to 小于等于
逻辑运算符
boolean x = (true && false); // false // logical and 并且
x = (true || false); // true // logical or 或者
x = !(true); // false // logical not 不是