Page 1 of 1

About Question enthuware.ocpjp.v7.2.1263 :

Posted: Thu Apr 17, 2014 1:33 am
by M.Komarov
Hi!

1. It is necessary to replace "list3" in option 3 with "list". Otherwise the message "cannot find symbol" will appear in line
System.out.println(list.get(0));
2. It seems to me that the explanation
Remember that wild card (i.e. ?) is never used while creation of the generic type object.
is not very clear.
The first special case of combining wild card ? and new keyword is illustrated here: http://docs.oracle.com/javase/tutorial/ ... print.html (right after words "However, you can still use wildcard arrays"):
List<?>[] lsa = new List<?>[10];
The second example (which also compiles fine) I've found in the description of JAX-RS Web Services:
public Set<Class<?>> getClasses() {
Set<Class<?>> set = new HashSet<Class<?>>();
set.add(MyClass.class);
return set;
}

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

Posted: Thu Apr 17, 2014 10:13 am
by admin
You are right. This has now been fixed.
thank you for your feedback!
Paul.