12.运算符

1算术运算符:
+ — * \ % ++ --


2关系运算符
> >= < <= == !=


3.布尔运算符
&&并且 ||或者 !非 &逻辑与 |逻辑或 !逻辑非 ^逻辑异或


4位运算符 位表示的是二进制位
& | ~ ^ >> >>> <<
&按位与and[真真为真,真假为假]
| 按位 或or [假假为假,其余全为真]

~按位非not[真则假,假则真]

>> 右移

>>> 右移 ,右边空出的位以0填充

<< 左移


5赋值类运算符
= += -= *= %= /=

6字符串连接运算符
+


7条件运算符
?: 即又称三步运算符

8其他运算符
instanceof new


//++出现在变量的后面
int m=10;
int e=m ++;
System.out.println("e="+e);//10
System.out.println("m="+m);//11


//++出现在变量的前面
int f=10;
++f;
System.out.println("f="+f);//11


int c=10;
int d=++c;//++如果出现在变量的前面,先自加1再做赋值运算
System.out.println("d="+d);//11
System.out.println("c="+c);//11


int z=10;
System.out.println(z++);//10
System.out.println(z);//11


int y=10;
System.out.println(++y);//11
System.out.println(y);//11

 

posted @ 2017-04-01 11:22  Melvon  阅读(118)  评论(0编辑  收藏  举报