public class Test {
public static void main(String[] args) {
Test t=new Test();
t.new Inner();
new StaticInner();
}
static class StaticInner{
//
}
public class Inner{
//
}
public static void main(String[] args) {
Test t=new Test();
t.new Inner();
new StaticInner();
}
static class StaticInner{
//
}
public class Inner{
//
}
}
静态内部类可以直接new, 非静态内部类要先实例外部类,然后才能new内部类