Page 1 of 1

About Question enthuware.ocpjp.v7.2.1267 :

Posted: Thu Oct 25, 2012 4:50 am
by D3x!
Here, list2 is a list of any thing. You cannot add any thing to it and you can only retriev Objects from it:
I am sure you mean you can add anything to it? not cannot?

Re: About Question enthuware.ocpjp.v7.2.1267 :

Posted: Thu Oct 25, 2012 8:20 am
by admin
No, the given comment is correct.

list2.add(new Object());
and
list2.add("aaa");

will not compile.

HTH,
Paul.

Re: About Question enthuware.ocpjp.v7.2.1267 :

Posted: Thu Sep 26, 2013 12:11 pm
by Student
But you can add null though, yes?

Re: About Question enthuware.ocpjp.v7.2.1267 :

Posted: Thu Sep 26, 2013 6:34 pm
by admin
Yes, null can be added. It has now been added in the explanation. Thank you for your feedback!