变量初始化问题,为什么只有第二种情况编译通过?
- (1)
- static final int x;
- public static void main(String[] args)
- {
- System.out.println(x);
- }
-
- (2)
- static int x;
- public static void main(String[] args)
- {
- System.out.println(x);
- }
- (3)
- public static void main(String[] args)
- {
- int x;
- System.out.println(x);
- }
复制代码 |
|