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

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

Moderator: admin

Post Reply
stoci

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

Post by stoci »

How is A correct? I thought Runnable was an interface and could therefore not be instantiated? What are you passing to 'Thread t' if 'Runnable a' isn't instantiated?

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

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

Post by admin »

You are right. An interface cannot be instantiated. But here in option A, when you do new Runnable(){ ... } you instantiate an anonymous class that implements Runnable interface.

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

stoci

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

Post by stoci »

Thanks, that makes sense.

lavinia

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

Post by lavinia »

Why the correct answers are not OnlyA and OnlyC because you cannot put them together the A and C portions of code, because they use same identifier a as a Thread or as a Runnable, so you can put only one piece of code once, A or C. Otherwise what sense makes the last two options?

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

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

Post by admin »

That is because the question wants you to select two options. So if one thinks that option C is not right and A is right, he can select A and Only A.
select the options Only A and Only C, will not make sense.

Finally, the right anwer is A and C.

HTH,
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: No registered users and 218 guests