I have a two-part question
My book says: "If a wildcard is specified without the upper, then only methods of type Object can be called on the values โโof the wildcard type"
I have no idea what this can mean. What does it mean?
Also, what are the restrictions on the types of wild cards (unlimited and limited)? For example, if I have a link to MyClass<?>
Or MyClass<? extends SomeOtherClass>
MyClass<? extends SomeOtherClass>
which methods I am not allowed to call through this link. I donโt understand what the wild card allows or forbids me to do , which is probably why I donโt understand the quote from this book.
I have an example for the second part:
class SomeOtherClass { [...] } class MyClass<T> { [...] } class Test { public static void main(String[] arg) { MyClass<? extends SomeOtherClass> myClass = new MyClass<String>()
source share