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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
shkolnik
Posts: 8
Joined: Tue Oct 25, 2011 10:46 am
Contact:

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

Post by shkolnik »

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.

stessy
Posts: 7
Joined: Sat Nov 12, 2011 5:38 am
Contact:

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

Post by stessy »

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.

shkolnik
Posts: 8
Joined: Tue Oct 25, 2011 10:46 am
Contact:

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

Post by shkolnik »

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.

stessy
Posts: 7
Joined: Sat Nov 12, 2011 5:38 am
Contact:

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

Post by stessy »

Normally, both should be accepted. Thread.yield() or the scheduler (No action required).

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

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

Post by admin »

You are right. It should accept "No code required" as well. This has now been fixed.

thank you for your feedback!
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 19 guests