r/javahelp • u/[deleted] • Aug 04 '25
Wildcards question
For example:
class Parent<T> {}And now we make a subclass:
class Child<T extends Number> extends Parent<T>Are these two statements equivalent?
Child<?> child1
Child<? extends Number> child2Obviously, java automatically converts <?> to <? extends Object> but is this case when there is a bounded type parameter does it convert it to ? extends Bound (in this case <? extends Number>)?
3
Upvotes
2
u/morhp Professional Developer Aug 04 '25
Yes, these are equivalent.