I am sure you mean you can add anything to it? not cannot?Here, list2 is a list of any thing. You cannot add any thing to it and you can only retriev Objects from it:
About Question enthuware.ocpjp.v7.2.1267 :
Moderators: Site Manager, fjwalraven
About Question enthuware.ocpjp.v7.2.1267 :
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1267 :
No, the given comment is correct.
list2.add(new Object());
and
list2.add("aaa");
will not compile.
HTH,
Paul.
list2.add(new Object());
and
list2.add("aaa");
will not compile.
HTH,
Paul.
-
- Posts: 53
- Joined: Fri Sep 20, 2013 7:20 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1267 :
But you can add null though, yes?
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1267 :
Yes, null can be added. It has now been added in the explanation. Thank you for your feedback!
Who is online
Users browsing this forum: No registered users and 8 guests