求助-为什么方法内部的类不能是static的
Routz 2016-01-14 09:00:39 static的内部不能有非static的成员我明白,但是为什么局部内部类不能是static的呢?为什么在方法内的内部类就可以是static的呢?
class Test1 {
public static void main(String[] args) {
A a = new A();
a.B.m2();
}
}
class A {
void m1() {
static class B {
static void m2() {
System.out.println("qwe");
}
}
}
}