类型擦除、重写和泛型
2022-09-01 06:05:57
有人可以向我解释为什么
@Override
public void fooMethod(Class<?> c)
不覆盖
public void fooMethod(Class c)
并给我以下错误:
- Name clash: The method fooMethod(Class<?>) of type SubClass has the same erasure as fooMethod(Class) of type SuperClass but does not override it - The method fooMethod(Class<?>) of type SubClass must override a superclass method
?
编辑:“”表示 Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)。至于代码片段,它已经在上面了,差不多;以上扩展了下面的一个。java -version