运算符
-
cast:转换
-
操作数中若有long类型,则结果为long类型;若没有long类型,则结果为int类型,无论操作数中是否有int类型。
long a = 12235555L;标签:int,long,运算符,类型,println,out From: https://www.cnblogs.com/sunfy/p/17017923.html
int b = 123;
short c = 10;
byte d = 8;
System.out.println(a + b + c + d); //long
System.out.println(b + c + d); //int
System.out.println(c + d); //int
//幂运算 工具类
double pow = Math.pow(2,3); //8.0
//短路运算
int c = 5;
boolean d = (c<4)&&(c++<4);
System.out.println(d); //false
System.out.println(c); //5
/*
位运算:效率极高!
<< *2
>> /2
*/
System.out.println(2 << 3); //16
//字符串连接符:+ String
System.out.println("" + a + b); //1020
System.out.println(a + b + ""); //30