This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Statements regarding to the Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Statements regarding to the Thread" Watch "Statements regarding to the Thread" New topic
Author

Statements regarding to the Thread

Jo Liang
Greenhorn

Joined: Dec 10, 2001
Posts: 11
What CAN directly cause a thread to stop executing?
A. Existing from a synchronized block
B. Calling the wait method on an object
C. Calling notify method on an object
D. Calling read method on an InputStream object
E. Calling the SetPriority method on a Thread object
Can somebody help me with this one? Thank you.
An other question, while a thread is running (already got the CUP), it that possible that other tread with higher priority (in Ready-to-Run state) takes over?

R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
A. Existing from a synchronized block:
No it does not gaurantee that thread will stop executing.
B. Calling the wait method on an object
Yes thread will stop executing, leave the monitor
C. Calling notify method on an object
No it does not gaurantee that thread will stop executing.
D. Calling read method on an InputStream object
Thread will not stop executing but will be in blocked state(I do not know whether it will come under not executing state.)
E. Calling the SetPriority method on a Thread object
will depend on OS.
CMIW
------------------
Regards
Ravish


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
A:FALSE
B:TRUE
C:FALSE
D:One cant say that does the i/p task is completed as it is required by thread or it has to wait.In 2nd condition it goes to wait state & it's execution stops.
E:FALSE
------------------
Count the flowers of ur garden,NOT the leafs which falls away!


Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining http://groups.yahoo.com/group/IBM340Exam/
 
Consider Paul's rocket mass heater.
 
subject: Statements regarding to the Thread