File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Threads" Watch "Threads" New topic


fraternity lawson

Joined: Mar 11, 2001
Posts: 26
What wight cause the current thread to stop excutings?
A.thread of higher priority become ready. B.method sleep() be called.
C.method stop() be called D.method suspend() be called.
E.method wait() be called

c,b,d,e seem's to be the right answer's.Option A depend's on the platform.Do let me know whether the selected answer's are right or wrong.
Ash sav
Ranch Hand

Joined: Apr 14, 2001
Posts: 55
According to me a,b,c,d,e all are correct. Just now I'm done with marcuss green exam and i got almost similar question. So if thread with highest priority is ready then currect thread will stop executing
nitin sharma
Ranch Hand

Joined: Feb 24, 2001
Posts: 290
hi ashv,
I go with fraternity on this because if the scheduler is time slice then a thread with higher priority will have no effect,if the scheduler is prepmptive then it will preempt the lower priority thread.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13035
"What wight cause the current thread to stop excutings?"
That "wight" is a very crucial misprint. The question has different answers if that should be "will" versus if it is "might" - which is it supposed to be?
Tracy Qi
Ranch Hand

Joined: Apr 23, 2001
Posts: 37
I have seen similar questions all around. My questions is:
How about the thread create a intreputed exception during the execution. Will this stop the thread? I think it will, But seems nobody agree with me. Can somebody tell me why?


John M. Gabriele
Ranch Hand

Joined: Feb 18, 2001
Posts: 232
note that there won't be any questions on the exam
regarding deprecated methods. Thread's stop() is
Simon Baker

Joined: May 04, 2001
Posts: 2
suspend() is also deprecated. The question was probably "might" in which case it looks as though all options are valid. As far as the Java code is concerned you cannot predict whether a higher priority thread will cause the current thread to move to the ready-to-run state. This behaviour is dependant on the thread scheduler, which in turn depends on the underlying platform. Java is platform independent and so the language itself does not enforce how the scheduler should operate.
Ravindra Mohan
Ranch Hand

Joined: Mar 16, 2001
Posts: 216
Hi folks,
Let me sum it up , on the discussion in this thread. This question is from marcus green's test. The correct in the test is
(A), (B) and (E). The reason as pointed out is on account of the fact that suspend() , stop() methods are deprecated in Java 2.
In the SCJP context we must be very careful on the
wording of the question. The question here cleverly asks that
What wight cause the current thread to stop excutings?
The catch is "might" and NOT "will".
I guess this will end the discussion regarding this issue.
Ravindra Mohan

I agree. Here's the link:
subject: Threads
It's not a secret anymore!