클래스 B를 확장하지 않으면 출력이 "1233"이지만 클래스 A를 사용하여 클래스 B를 확장하는 것이 컴파일되지 않는 이유는 무엇입니까?java 및 generics의 상속
public class SomeClass {
public static class A {
public void f(int x){
System.out.print("1");
}
public void f(Object x){
System.out.print("2");
}
}
public static class B // extends A {
public <T> void f(T x){
System.out.print("3");
}
}
public static void main(String[] args){
A a=new A();
B b=new B();
a.f(3);
a.f("hello");
b.f(3);
b.f("hello");
}
}
오류 메시지에 표시되는 내용은 무엇입니까? –