本帖最后由 孙百鑫 于 2013-6-17 07:10 编辑
- public class Test7
- {
- public static void main(String[] args)
- {
- new Demo().new Inner().changeName();
- }
- }
- class Demo
- {
- private String name = "mike";
- private void printName(String name)
- {
- System.out.println(name);
- }
- class Inner
- {
- Demo.this.name = "lucy";//这行报错
- public void changeName()
- {
- Demo.this.printName(Demo.this.name);
- }
- }
- }
复制代码 错误是:
Test7.java:18: 错误: 需要<标识符>
Demo.this.name = "lucy";
^
Test7.java:18: 错误: 需要';'
Demo.this.name = "lucy";
^
Test7.java:18: 错误: 需要<标识符>
Demo.this.name = "lucy";
^
|