I know why answer C is right, but then the question I have is why answer A is wrong?
public List<Integer> getList(){
// why is this answer incorrect ???
About Question enthuware.ocpjp.v21.2.3087 :
Moderator: admin
-
nnavlani
- Posts: 11
- Joined: Sat Aug 02, 2025 11:21 pm
- Contact:
-
admin
- Site Admin
- Posts: 10444
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v21.2.3087 :
Because List<Integer> is not a subtype of List<Number>. Go through the rule of covariant returns given in the explanation. It shows two hierarchies of generic types. Read that carefully.
-
tommchris
- Posts: 2
- Joined: Tue Feb 25, 2025 3:13 am
- Contact:
Re: About Question enthuware.ocpjp.v21.2.3087 :
The exact content of the question (what it asks) is not visible from the publicly-listed forum excerpt I found — you’ll likely need to be logged in or access the question via your Enthuware account to view the full question. Bloodmoney Game
Who is online
Users browsing this forum: No registered users and 15 guests