Hello,
I'm bussy with OCP and Chapter 3 there Upper-Bounded Wildcards.
There is an example like:
But what is Number?
What kind of objects can I add to this list?
It is compiling, it running...
The method they give in the book:
Or is this a mistake in the book (typo) in the declaration? (is not mentioned in the studyguide as a mistake)
I'm asking this, because the declaration is with "List<? extends Number>" and not as 'norma'l with "List<Integer>", see example Tutorialspoint below.
I have found this on Tutoiralspoint:
But I can follow this how this works but what is Number? Number does not exist in Java as far as I remember. Is not declared anywhere. I know/understand that the ? wil be converted to Object (tyep erasue)
Nico