< T>有什么区别? < T扩展Object>在java中? [英] What is the difference between <T> and <T extends Object> in java?
本文介绍了< T>有什么区别? < T扩展Object>在java中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Java泛型中,使用类GenericStack< T扩展Object>有什么好处? {}
超过了类GenericStack< T> {}
。
In Java generics, What is the advantage of using class GenericStack<T extends Object> {}
over class GenericStack<T>{}
.
我已经实现了使用上述两种方法的通用堆栈,但无法找出差异。
I have implemented a generic stack using both of the above approaches but unable to trace out the difference. Help me to understand this.
推荐答案
没有什么区别。 < T>
和< T扩展对象>
是等效的。
There's no difference. <T>
and <T extends Object>
are equivalent.
这篇关于< T>有什么区别? < T扩展Object>在java中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文