Wednesday, April 30, 2008
38. What is multithreading and what are the methods for inter-thread communication and what is the class in which these methods are defined?
Multithreading is the mechanism in which more than one thread run independent of each other within the process. wait (), notify () and notifyAll() methods can be used for inter-thread communication and these methods are in Object class. wait() : When a thread executes a call to wait() method, it surrenders the object lock and enters into a waiting state. notify() or notifyAll() : To remove a thread from the waiting state, some other thread must make a call to notify() or notifyAll() method on the same object.
Posted by javapeople at 4/30/2008 12:06:00 PM