在java中,我可以做一些类似这样的事情吗?以及如何?
public class SomeGenericClass<T> extends T{
}
最佳答案
我认为这是 JLS ( §8.1.4 ) 的相关引用:
The ClassType [provided in the
extends
clause] must name an accessible (§6.6) class type, or a compile-time error occurs.
(有关可访问性的部分不相关)。
类类型为not the same thing as a type variable (§4.3) (T
就是),因此尝试执行此操作将导致编译时错误。
关于java - 在Java中,我可以继承由类型参数提供的类吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33752909/