本帖最后由 聂益飞 于 2013-3-22 22:21 编辑
- class Fu
- {
- int x = 5;
- int y =8; //编译失败
- void method()
- {
- int y=9;
- y=7; //这里编译没报错,为什么局部变量这样做对,成员变量就不行
- }
-
-
-
-
- }
- class Zi extends Fu
- {
- int b=6;
-
-
- }
- class Demo14
- {
- public static void main(String []args)
- {
- Zi m = new Zi();
- int c = 5;
- c = 6;
- System.out.println(m.x);
- }
- }
复制代码 |