【发布时间】:2011-06-10 17:33:48
【问题描述】:
我正在用 Java 中的数字转换和强制转换进行一些测试,我发现了这种奇怪的行为(对我来说)
class Test {
public static void main(String[] args) {
//int y = 100000000000000; //does not compile
int x = 100000 * 1000000000; //compile (why?)
System.out.println(x); //x is 276447232
}
}
x 和 y 基本上应该是同一个数:为什么会编译?
【问题讨论】:
标签: java variable-assignment numeric