Hi,
I did the exam here:
http://www.javaranch.com/maha/_Mock_Exams/JohnJuntMockExam.htm I don't understand Q34. Why the answers are A,B,C,D?
------------------------------------------------------
Q. 34
Which methods may cause a thread to stop executing?
A.sleep();
B.stop();
C.yield();
D.wait();
E.notify();
F.notifyAll()
G.synchronized()
Select all correct answers.
---------------------------------------------------------
According to Mock Exam in Khalid's book,
Q11:Under which circumstance will a thread stop?
(a) The method waitforId() in class MediaTracker is called.
(b) The run() method that the thread is executing ends.
(3) The call to the start() method of the Thread object returns.
(d) The suspend() method is called on the Thread object.
(e) The wait() method is called on the Thread object.
The answer to Q11 is (b). As Khalid's explaination, Calls to methods suspend(), sleep() and wait() do not stop a thread. they only cause a thread to move out of its running state.
so, why in John Hunt answer,A C D are correct?
I am confused.
Thanks.
Cindy