class Outer{ // 定义外部类 private static String info = "hello world" ; // 定义外部类的私有属性 static class Inner{ // 使用static定义内部类为外部类 public void print(){ // 定义内部类的方法 System.out.println(info) ; // 直接访问外部类的私有属性 }
没有啊,你只是执行的Outer的内部类的print方法 追问
0 18
您好,提问者: 我看了一下你的程序,感觉是可以执行的,MyEclipse卡死了,不然就测试一把了。 追问
0 17
没有执行 如想执行 用new Outer().fun() 追问
0 15
很明显的,没有吧 追问
0 13
没有运行fun()方法,刚刚帮你用调试方式单步运行了下。
0 9
执行结果是:hello world方法执行了
0 4