This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread 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 Android Security Essentials Live Lessons this week in the Android 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/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Statements regarding to the Thread
 
Similar Threads
Wait inside Synchronize doubt
regarding thread.
Failure mode of two reference calls to one thread
setPriority method on a thread object directly cause a thread to stop executing ?
Thread