62,634
社区成员




class T {
static class Nested {
void sayHello() {
System.out.println("hello");
}
}
}
class C {
public static void main(String... args) {
new T.Nested().sayHello(); //不需要外部类T的实例,这里T只是一个类Nested的限定名称的一部分
}
}
class T {
class Nested {
void sayHello() {
System.out.println("hello");
}
}
}
class C {
public static void main(String... args) {
new T().new Nested().sayHello(); // 外部类T的实例 new T()是必须的
}
}