About Question enthuware.ocpjp.v7.2.1263 :

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

Post Reply
M.Komarov
Posts: 17
Joined: Fri Sep 06, 2013 1:37 am
Contact:

About Question enthuware.ocpjp.v7.2.1263 :

Post 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;
}

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

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

Post by admin »

You are right. This has now been fixed.
thank you for your feedback!
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests