class Outer{ String name="大哥"; int age=20; public class Inner{ String name ="小弟"; public void show(){ System.out.println("外部类的名字是:"+Outer.this.name); System.out.println("外部类的年龄是:"+age); System.out.println("内部类的名字是:"+name);
} } } public class Dome0{ public static void main(String []args) { Outer o = new Outer(); Inner n= o.new Inner(); n.show(); } }