public class Father { //外部类
private String name="zhangsan";
class Child{ //内部类
public void introFather(){
System.out.println("Father的name值是:"+name);
}
}
}
public class Test { //测试类
public static void main(String[] args) {
Father father = new Father();
Father.Child child =father.new Child();
child.introFather();
}
}
//输出结果:
Father的name值是:zhangsan