【发布时间】:2015-11-17 08:33:35
【问题描述】:
我正在初始化两个整数 a 和 b。
a 编译良好,但b 出现错误。
public class Main_1 {
public static void main(String[] args) {
int a = -2147483648; //Working fine
int b = -(2147483648); //Compilation error: The literal 2147483648 of type int is out of range
}
}
请帮助我理解这种行为?
【问题讨论】:
-
编译器错误提示了这一点,不是吗?
-
不,这不是提示,而是错误...:)
标签: java compiler-errors int