运算符
![5945886-9ea44889bc428e84.png](https://upload-images.jianshu.io/upload_images/5945886-9ea44889bc428e84.png)
一、算术运算符。
%代表取余。
![5945886-ad56ffc33dc6a3f6.png](https://upload-images.jianshu.io/upload_images/5945886-ad56ffc33dc6a3f6.png)
对于一元运算符,++符号在变量的前面与在变量的后面,效果是不一样的。具体看上图。
二、布尔逻辑表达式
主要需要注意短路问题;
![5945886-f5fcf51778355e6b.png](https://upload-images.jianshu.io/upload_images/5945886-f5fcf51778355e6b.png)
三、位运算
![5945886-b56ffce0ba8b513f.png](https://upload-images.jianshu.io/upload_images/5945886-b56ffce0ba8b513f.png)
第二行,若是3<<3就代表左移三次也就是,322*2。
相同情况,3<<3比322*2要快很多。
四、字符串连接符
![5945886-7ab1d6d13493b228.png](https://upload-images.jianshu.io/upload_images/5945886-7ab1d6d13493b228.png)
4+"5"的结果会是"45"
五、三元条件运算符
![5945886-33bcd34af1886114.png](https://upload-images.jianshu.io/upload_images/5945886-33bcd34af1886114.png)
%代表取余。
对于一元运算符,++符号在变量的前面与在变量的后面,效果是不一样的。具体看上图。
主要需要注意短路问题;
第二行,若是3<<3就代表左移三次也就是,322*2。
相同情况,3<<3比322*2要快很多。
4+"5"的结果会是"45"