java9

一。自增自减
++ --
必须用在!变量!的前后
在未参与运算时,a++和++a的结果是一样的
int a = 10;
a++;
System.out.println(a);
【11】
OR
++a;
System.out.println(a);
【11】
在参与运算时,a++代表是自增前的结果参与运算,
int b = a++;
System.out.println(b); //b仍是a的原结果
【11】
System.out.println(a); //而a本身已自增
【12】
++a代表是自增后的结果参与运算
int c = ++a;
System.out.println(c); //c是a自增后的结果
【13】
System.out.println(a);
【13】
复杂运算:
int num = 1;
int e = (num++)+5;
System.out.println(num);
【2】
System.out.println(e); //1+5
【6】
int m = 2;
int r = ++m +5+ m- - + m
System.out.println(r); //3+5+3+2
【13】
二.
赋值运算符
= ,+= ,-=,*=,/=,%=
三。
比较运算符
比较运算符的结果是一个布尔类型
, !=, >, <, >=, <=
int a = 1;
int b = 2;
System.out.println(a
a);
System.out.println(a<=a);
System.out.println(a>=b);
System.out.println(a<b);

原文地址:https://www.cnblogs.com/-zero/p/10205374.html