getMethods与public override方法
public class TT {
public static void main(String[] args) {
System.out.println(B.class.getMethods().length);
System.out.println(C.class.getMethods().length);
}
private static class A {
public A xxx() {
return new A();
}
}
private static class B extends A {
@Override
public B xxx() {
return new B();
}
}
private static class C extends A {
@Override
public A xxx() {
return new C();
}
}
}
11
10
public class TT {
public static void main(String[] args) {
System.out.println(B.class.getMethods().length);
System.out.println(C.class.getMethods().length);
}
private static class A {
public A xxx() {
return new A();
}
}
private static class B extends A {
@Override
public B xxx() {
return new B();
}
}
private static class C extends A {
@Override
public A xxx() {
return new C();
}
}
}