aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes thread execution! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "thread execution!" Watch "thread execution!" New topic
Author

thread execution!

ashok khetan
Ranch Hand

Joined: Jul 29, 2001
Posts: 153
Q.22 What can cause a thread to stop executing?(From Marcus mock2)
1) The program exits via a call to System.exit(0);
2) Another thread is given a higher priority
3) A call to the thread's stop method.
4) A call to the halt method of the Thread class?
how can the option 2) be right? The question states to stop the execution not to stop the thread temporarily.
ashok.
Geoffrey Falk
Ranch Hand

Joined: Aug 17, 2001
Posts: 171
    
    1
(1) is definitely right.
(2) I guess it depends on your definition of "stop executing" which is ambiguous IMHO. It oculd mean to temporarily take away CPU cycles from the thread, or to logically stop the thread. The designers of the Sun Java exam have worked hard to eliminate any linguistic ambiguity; so, as long as you understand the concepts of threading, you should not be troubled by mock questions such as this.
(3) The "stop" method is deprecated, so there will not be any questions about it on the exam.
(4) is wrong, because there is no "halt" method.
Geoffrey

------------------
Sun Certified Programmer for the Java 2 Platform


Sun Certified Programmer for the Java 2 Platform
Ragu Sivaraman
Ranch Hand

Joined: Jul 20, 2001
Posts: 464
(1) is perfect
(2) I cant accept that
What if the OS thread scheduling is RoundRobin?(For ex: Windoze)
-Ragu
marilyn murphy
Ranch Hand

Joined: Aug 28, 2001
Posts: 84
The question is
Q.22 What can cause a thread to stop executing?
not
Q.22 What will cause a thread to stop executing?
If a another thread has a higher priority, in certain systems it may cause the current thread to stop. The stop may be temporary or permanent (if System.exit is called for example).
 
Don't get me started about those stupid light bulbs.
 
subject: thread execution!