About Question com.enthuware.ets.scjp.v6.2.416 :
Moderator: admin
About Question com.enthuware.ets.scjp.v6.2.416 :
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?
-
- Site Admin
- Posts: 10066
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.416 :
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.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
Re: About Question com.enthuware.ets.scjp.v6.2.416 :
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?
-
- Site Admin
- Posts: 10066
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.416 :
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.
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.
Who is online
Users browsing this forum: No registered users and 218 guests