About Question enthuware.ocpjp.v8.2.1263 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
raphaelalex
Posts: 1
Joined: Thu Apr 14, 2016 10:58 am
Contact:

About Question enthuware.ocpjp.v8.2.1263 :

Post by raphaelalex »

In explanation the following code actually works:

Code: Select all

List<String> list = new ArrayList<>();
List<? extends String> list2 = new ArrayList<>();
list.add("A");
list.addAll(new ArrayList<>());
list.addAll(list2);
System.out.println(list.size());
please, review explanation section with a valid example.
Thanks. ;)

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

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

Post by admin »

Unfortunately, it doesn't compile in Java 7 but does compile in Java 8.
Even Oracle's official tutorial says it should not compile.

-Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 32 guests