The question is: "Identify the code that can potentially move a thread from one state to another"
Under the arrow from Running --> Runnable, I have put "No code required", because JVM can at any time decide to move the thread from Running to Runnable without any code hints.
This answer has be marked as wrong.
About Question com.enthuware.ets.scjp.v6.2.79 :
Moderators: Site Manager, fjwalraven
-
- Posts: 8
- Joined: Tue Oct 25, 2011 10:46 am
- Contact:
-
- Posts: 7
- Joined: Sat Nov 12, 2011 5:38 am
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.79 :
The important keyword in that question is "Potentially".
The yeld() can potentially move the current running Thread to the Runnable pool. But it's not guaranteed.
The yeld() can potentially move the current running Thread to the Runnable pool. But it's not guaranteed.
-
- Posts: 8
- Joined: Tue Oct 25, 2011 10:46 am
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.79 :
I am not disputing that Thread.yield() is a correct answer. My point is that "no code required" is also correct. Wouldn't you agree that following is true?
"No code is required to potentially move a thread from running to runnable"
The test should be modified to accept "no code is required" as a correct answer.
"No code is required to potentially move a thread from running to runnable"
The test should be modified to accept "no code is required" as a correct answer.
-
- Posts: 7
- Joined: Sat Nov 12, 2011 5:38 am
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.79 :
Normally, both should be accepted. Thread.yield() or the scheduler (No action required).
-
- Site Admin
- Posts: 9839
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.79 :
You are right. It should accept "No code required" as well. This has now been fixed.
thank you for your feedback!
thank you for your feedback!
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 0 guests