问题
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.
回答1:
There's no difference. <T> and <T extends Object> are equivalent.
来源:https://stackoverflow.com/questions/30206340/what-is-the-difference-between-t-and-t-extends-object-in-java