数据类型之间的运算
package operator;
import static java.lang.Character.getType;
public class Demo02 {
public static void main(String[] args) {
long a = 123123123123123L;
int b = 123;
short c = 10;
byte d = 8;
double pi = 3.14;
System.out.println(pi+a+b+c+d);
System.out.println(a+b+c+d);//long
System.out.println(b+c+d);//Int
System.out.println (c+d);//Int 任意非long整数运算,结果总是Int型
}
}

浙公网安备 33010602011771号