Page 1 of 1
About Question com.enthuware.ets.scjp.v6.2.416 :
Posted: Thu Nov 17, 2011 10:47 am
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?
Re: About Question com.enthuware.ets.scjp.v6.2.416 :
Posted: Thu Nov 17, 2011 8:15 pm
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.
Re: About Question com.enthuware.ets.scjp.v6.2.416 :
Posted: Fri Nov 18, 2011 3:23 pm
by stoci
Thanks, that makes sense.
Re: About Question com.enthuware.ets.scjp.v6.2.416 :
Posted: Tue Mar 27, 2012 6:41 am
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?
Re: About Question com.enthuware.ets.scjp.v6.2.416 :
Posted: Tue Mar 27, 2012 9:25 am
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.