Difference between Bounded Type parameter (T extends) and Upper Bound Wildcard (? extends)

后端 未结 5 1076
余生分开走
余生分开走 2020-12-16 14:18

I know that there was a similar question already posted, although I think mine is somewhat different...

Suppose you have two methods:

// Bounded type         


        
5条回答
  •  暖寄归人
    2020-12-16 14:50

    The difference is on the compiler side. On the first one you can use the type (to cast something or use it as a bound to call another method for example) while on the second one, you cannot use it.

提交回复
热议问题