About Question com.enthuware.ets.scjp.v6.1.815 :

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

Moderator: admin

Post Reply
ETS User

About Question com.enthuware.ets.scjp.v6.1.815 :

Post by ETS User »

I don't think this is right. Please correct me if I am wrong, but here is what I have.

Step 1:
s = [324, 325, 326, 327, 328]
sub = [326, 327, 328] // because the true,true it should include both 326 and 328

add 329.


s = [324, 325, 326, 327, 328, 329]
sub = [326, 327, 328] // because 329 is out of range of the subset


If I am wrong, can you tell me how the true, true values work in .subSet??

thanks

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

Re: About Question com.enthuware.ets.scjp.v6.1.815 :

Post by admin »

The important point to understand here is that returned subset is backed by the original set and it is constrained by the range given while its creation. It is not a new set in which you can add anything. Therefore, you cannot add 329 to this subset because it will violate the range for which this subset was created.

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

piotrkmiotczyk
Posts: 27
Joined: Mon Sep 22, 2014 1:30 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.1.815 :

Post by piotrkmiotczyk »

What type of object is returned by subSet?

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

Re: About Question com.enthuware.ets.scjp.v6.1.815 :

Post by admin »

That depends on the class of Set on which you call subSet. You will need to chect the javadoc for that class.
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 228 guests