Two Laptop Bag*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes JQ Plus thread question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "JQ Plus thread question" Watch "JQ Plus thread question" New topic
Author

JQ Plus thread question

Tejas Tambe
Ranch Hand

Joined: Oct 08, 2001
Posts: 47
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
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
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


Rob
SCJP 1.4
Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
I do not believe Media Tracker is included in the SCJP2 objectives or in the exam question.
mark stone
Ranch Hand

Joined: Dec 18, 2001
Posts: 417
stop() method is deprecated in 1.2
so (b) should not be in the answer. Please confirm this.

Originally posted by Shivaji Marathe:
I do not believe Media Tracker is included in the SCJP2 objectives or in the exam question.
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3253
    
    2
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.


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
Tejas Tambe
Ranch Hand

Joined: Oct 08, 2001
Posts: 47
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.
Rick Reumann
Ranch Hand

Joined: Apr 03, 2001
Posts: 281
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JQ Plus thread question
 
Similar Threads
notify() question..
MediaTracker and Socket
Thread Question
JQ+->Threads-->waitForAll()
In reference to notify maybe pausing a thread?