package test; public class InnerClass { class W{ int num = 10; class N{ public void show() { System.out.println(W.this.num); } } } public static void main(String[] args) { InnerClass s = new InnerClass(); //建立外部類對象 InnerClass.W w = s.new W(); //外部類.內部類 w = 外部類對象.new 內部類() InnerClass.W.N n = w.new N(); //內部類的內部類,雙層 n.show(); } }