This question already has an answer here:
这个问题在这里已有答案:
- What's the difference between <?> and <? extends Object> in Java Generics? 3 answers
和 ? 3个答案
In Java generics, What is the advantage of using class GenericStack<T extends Object> {}
over class GenericStack<T>{}
.
在Java泛型中,使用类GenericStack
I have implemented a generic stack using both of the above approaches but unable to trace out the difference. Help me to understand this.
我已经使用上述两种方法实现了泛型堆栈,但无法找出差异。帮我理解这个。
1 个解决方案
#1
6
There's no difference. <T>
and <T extends Object>
are equivalent.
没有区别。
#1
6
There's no difference. <T>
and <T extends Object>
are equivalent.
没有区别。