Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock exam question

 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question is from the mock exam at www.geocities.com/SiliconValley/Screen/5046/ftest1.html.
The question says:
You have an application which executes the following line:
Thread myT = new Thread();
myT.start();
Select all of the following statements that are correct:
1. The thread myT is now in a runnable state.
2. The thread myT has the NORM_PRIORITY priority.
3. The thread will die without accomplishing anything.
4. The run method in the class where the statement occurs will be executed.
Correct answers are 1 & 3.
Why not 2?
Thanks.
Stephanie
 
Vivek Shrivastava
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think �2� is not correct because each thread gets its priority from its creating thread. So whatever priority parent thread have the new thread will get the same.
Feel free to correct me.

But here I have problem with option �1�. We all knows that start() method simply register the thread with thread scheduler and eventually thread scheduler will give a chance to this thread to run. So it is in ready to run state not in �runnable� state.
Please correct me. I am having hard time with threads today.
Your response will encourage me.

vivek


[This message has been edited by Vivek Shrivastava (edited July 21, 2000).]
 
vb shah
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runnable implies that "Ready to Run."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic