This code does not compile:
import java.util.List; class A { void foo(List l) { } } class B extends A { void foo(List<?> l) { } }
However, the following code compiles (foo in D overrides foo to C). Why?
class C { void foo(List<?> l) { } } class D extends C { void foo(List l) { } }
source share