本帖最后由 韩新凯 于 2012-4-24 22:33 编辑
L1.fun(); 改成l.fun();
这样写也是对的: L1.L2 ll = new L1().new L2();
ll.print();
还可以这么做,用static:class L1 {
private static String str = "Hello world";
static class L2 {
public static void print() {
System.out.println(str);
}
}
}
public class Nei {
public static void main(String[] args) {
L1.L2.print();
}
}
|