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 JQ+->Threads-->waitForAll() 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 "JQ+->Threads-->waitForAll()" Watch "JQ+->Threads-->waitForAll()" New topic


Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
OH!.I never ever heard about this method before in my life.... waitForAll()
Here is the question.
Question ID :958269346510
Which of the following may pause/stop the current thread?
1:calling Thread.yield()
2:calling stop() on an object of class Thread
3:calling someObject.wait()
4:calling someObj.notify()
5:calling waitForAll on MediaTracker Object
Correct Answer are 1,2,3 & 5.
A/C to me 1: is correct, since it is not must that the thread which has called yield will leave Running state.
2:is obviously correct,will stop the calling Thread.
3:The calling Thread will must leave the running state & move to waiting state(in this case monitor is also release)
4:wait(),notify() & notifyAll() are always called on Threads rather than Objects.
5: Viki.waitForAllRanchers()???

Count the flowers of ur garden,NOT the leafs which falls away!

Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining
Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
Three is no such method like waitForAll(). And That's for sure!!! Either the answers are wrong or you r having older version of JQ+
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Why calling aThread.stop() would stop other thread than aThread ? I don't think 2 is ok.
According to API MediaTracker.waitForAll waits untill all the images are loaded.

SCJP2. Please Indent your code using UBB Code
Jim Hall
Ranch Hand

Joined: Nov 29, 2001
Posts: 162
Originally posted by Rashmi Gunjotikar:
Three is no such method like [b]waitForAll(). And That's for sure!!! Either the answers are wrong or you r having older version of JQ+

You really should check the API before making a statement like that, because it does exist.
I agree. Here's the link:
subject: JQ+->Threads-->waitForAll()
It's not a secret anymore!