class Out { class In { public In(String msg) { System.out.println(msg); } } } public class CreateInner { public static void main(String[] args) { Out.In in; Out out = new Out(); in = out.new In("test"); } }
那么非静态内部类怎么在外部类之外创建一个子类呢?
public class SubClass extends Out.In { public SubClass(Out out) { out.super("hello"); } }