类型转换
public class Demo05 {
public static void main(String[] args) {
int i = 128;
byte b = (byte)i;
System.out.println(i);
System.out.println(b);
int j = 128;
double d = j;
System.out.println(j);
System.out.println(d);
System.out.println((int)23.7);
System.out.println((int)-45.89);
System.out.println("=============");
char c = 'a';
int e = c + 1;
System.out.println(e);
System.out.println((char)e);
}
}
public class Demo06 {
public static void main(String[] args) {
int money = 10_0000_0000;
int years = 20;
int total = money * years;
System.out.println(total);
long total2 = money * years;
System.out.println(total2);
long total3 = money * (long)years;
System.out.println(total3);
int a = 2;
int b = 1231231231;
long c = a*(long)b;
System.out.println(c);
}
}