2015-01-07 2 views

답변

4

같은 클래스에 선언되어 있으면 해당 값은 대체 값과 같으며 컴파일 오류가 발생합니다.

Two method signatures m1 and m2 are override-equivalent iff either m1 is a subsignature of m2 or m2 is a subsignature of m1.

The signature of a method m1 is a subsignature of the signature of a method m2 if either:

  • m2 has the same signature as m1, or
  • the signature of m1 is the same as the erasure (§4.6) of the signature of m2.

굵게 표시된 경우는 여기에 문제가있는 Java Language Specification

It is a compile-time error to declare two methods with override-equivalent signatures in a class.

에서

.

Class<?>의 삭제는 Class입니다.

Is there any difference between void f(Class c) and void f(Class c) in Java?

호출자의 관점에서 볼 때, 아니요. 방법 본문 내에서 네. 첫 번째 경우 매개 변수는 raw typeClass입니다. 두 번째 경우 매개 변수의 매개 변수화 된 형식은 Class<?>입니다.

0

실제로 ?은 매개 변수화 된 클래스/인터페이스와 함께 사용할 수있는 와일드 카드입니다. 예를 들어 Collection<Object>Object 유형의 항목을 포함하는 일반 모음이며 Collection<?>은 모든 유형의 컬렉션의 수퍼 유형입니다.

관련 문제