比如我有 class A,class B extends A;class template,class template。
要在 template 里存一个名叫 template_parent 的实例变量指向一个 template,而 template 的 template_parent 为 null。定义 template_parent 时想写 template is extended by B> 但是不让写。为什么 Java 不让这么写?我该怎么可以绕开这个限制来表达相同的意思?
Update: 好吧我欢乐多~~ is extended by B> 和 是一样的。。。
不是一样的哦。如果你想指定B的parent,或者B的parent的parent……可以用
<? super B>。<? is extended by V>可以用<? super V>来表示。