All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.
Moderators: Site Manager , fjwalraven
lexlexych
Posts: 1 Joined: Fri Jun 05, 2020 2:39 pm
Contact:
Post
by lexlexych » Tue Jun 09, 2020 2:40 am
Code: Select all
List<? extends Booby> bV = null;
List<? super Dooby> dV = null;
dV.add(new Dooby(){ }); // -> NullPointerException
bV.add(new Dooby(){ }); // -> NullPointerException
How can
dV.add(new Dooby(){ }); be the correct answer?
admin
Site Admin
Posts: 10101 Joined: Fri Sep 10, 2010 9:26 pm
Contact:
Post
by admin » Tue Jun 09, 2020 2:51 am
You are right. It has been updated as follows to make it clear:
List<? extends Booby> bV = //code for initialization
List<? super Dooby> dV = //code for initialization
thank you for your feedback!
If you like our products and services, please help us by posting your
review here .
Users browsing this forum: No registered users and 7 guests