int x;
double y;
x = (int) 22.5 + (int) 34.7;
y = (double) x;
System.out.println("x = " + x);
System.out.println("y = " + y);
输出结果:
x = 56
y = 56.0
int x;
double y;
x = (int) 22.5 + (int) 34.7;
y = (double) x;
System.out.println("x = " + x);
System.out.println("y = " + y);
输出结果:
x = 56
y = 56.0