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

About Thread topics

rajesh kumar rayavarapu

Joined: May 16, 2007
Posts: 12

When to use wait(),notify(),notifyAll(),.. all of these similar methods?

pls give the response immediatly
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15033

These methods are used for thread synchronization in multithreaded programs.
[ May 18, 2007: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Anita Singh

Joined: May 18, 2007
Posts: 17
The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to communicate each other.
wait():-Causes current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.
notify():-Wakes up a single thread that is waiting on this object's monitor.
notifyAll():-Wakes up all threads that are waiting on this object's monitor.

Anita Singh

SCJP 5.0 100%
I agree. Here's the link:
subject: About Thread topics
It's not a secret anymore!