About Question com.enthuware.ets.scjp.v6.2.88 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
devlam
Posts: 50
Joined: Sun Nov 10, 2013 4:39 am
Contact:

About Question com.enthuware.ets.scjp.v6.2.88 :

Post by devlam »

Why with List<? super Number> does allow only retrieving Object-instances. Why not also Number-instances?
I understand you cannot retrieve subclasses of Number but why not Number itself?

admin
Site Admin
Posts: 10398
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.88 :

Post by admin »

Because all you know is that the list contains objects of some class for which Number is-a that class is true. It could be Number itself but you are not sure. It could be some other class as well. That is why you can't take Number out of such a list.

You might want to go through this: viewtopic.php?f=2&t=473

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests