java小程序问题!!!

368关注1832浏览

class Outer{ // 定义外部类
private static String info = "hello world" ; // 定义外部类的私有属性
static class Inner{ // 使用static定义内部类为外部类
public void print(){ // 定义内部类的方法
System.out.println(info) ; // 直接访问外部类的私有属性
}

共6条回答
  • Adeline
    7年前

    没有啊,你只是执行的Outer的内部类的print方法 追问

    0 18

  • 刘福荣
    7年前

    您好,提问者:
    我看了一下你的程序,感觉是可以执行的,MyEclipse卡死了,不然就测试一把了。 追问

    0 17

  • Asher
    7年前

    没有执行 如想执行 用new Outer().fun() 追问

    0 15

  • W小姐
    7年前

    很明显的,没有吧 追问

    0 13

  • Chavez3
    7年前

    没有运行fun()方法,刚刚帮你用调试方式单步运行了下。

    0 9

  • Ryleigh
    7年前

    执行结果是:hello world
    方法执行了

    0 4

发送