Q id :958269346510 Which of the following may pause/stop the current thread? a. calling Thread.yield(); b. calling stop() on an object of class Thread; c. calling someObject.wait(); d. calling someObject.notify(); e. calling waitForAll() on MediaTracker Object Correct ans : a,b,c,e VERY similar question has been asked in SCJP2. Answer 5 is also correct because how else will MediaTracker do it's job if it does not pause the current thread?
I did not understand the concept behind option e. Also can u call object.wait(). Please explain. TIA Tejas
Since when do the objective for SCJP include knowing about MediaTracker?? I never heard about that requirement before! Anyway, calling wait() on an object first gives up the lock (the thread has to have the lock on the object before it can call wait()), then it blocks, waiting until it gets notified. It gets notified when some other thread calls notify() on the object the first thread is blocked in. Rob
Some people got this type of question in the previous version of the exam. We have not seen anybody getting it in the newer version but who knows I think, it would be better to clear this fact in the explanation. HTH, Paul.
Does that mean that the version i got recently from your Indian correspondent , Hanumant deshmukh is old? I bought this s/w 2 months back...the question bank also contains some questions from jdk1.1 like, bitset. also there are some questions from swing too. Tejas.
I did a seach on this question because I just had this question on JQ+. Besides not have a clue about MediaTracker (and now since taking the test on Tuesday, don't even want to mess with it), but how come d) "calling someObj.notify()" is not a correct answer? If there happens to be some other threads waiting couldn't calling notify(), notify one of them and possibly dump the current thread into a paused state while this new thread ones (due to the scheudling of the system)? I must be missunderstanding this question because even the JQ+ study notes mention notify() as a possible way to pause another thread.. http://enthuware.com/jqplus/scjp2notes/Threads.html
Everybody! Do the Funky Monkey! Like this tiny ad!
Programmatically Create PDF Using Free Spire.PDF with Java