(1) <外部类类名>.<内部类类名> 引用变量=<外部类对象引用>.new<内部类构造器>;
(2) <外部类类名>.<内部类类名> 引用变量=new <外部类构造器>.new <内部类构造器>;
package lbl1;
class Outer
{
class Inter
{
public void show() {
System.out.println("恭喜你创建了内部类对象"+"并且调用了内部类中的方法");
}
}
// public void createrInner()
// {
// Inter i=new Inter();
// i.show();
// }
}
public class Eg1 {
public static void main(String args[])
{
Outer o=new Outer();
Outer.Inter s=o.new Inter();
s.show();
}
}