|
Regards,<BR>Shree
class Waiter extends Thread {
public synchronized void run() {
try {
Thread notifyThread = new Thread(new Notifier());
notifyThread.start();
wait();
}
catch (InterruptedException ie) {
System.out.println("Interrupted.");
}
System.out.println("Waiter back in control.");
}
}
class Notifies extends Thread {
public synchronized void run() {
System.out.println("Notifier running.");
try {
System.out.println("Going to sleep.");
Thread.sleep(100);
System.out.println("Woke up.");
}
catch (InterruptedException ie) {
System.out.println("Interrupted.");
}
System.out.println("Back to waiter.");
notifyAll();
}
}
public class Waiting {
public static void main(String[] args) {
Thread waitThread = new Thread(new Waiter());
waitThread.start();
}
}
SCJP
Visit my download page
SCJP
Visit my download page
SCJP
Visit my download page
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
....
SCJP
Visit my download page
....
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
SCJP
Visit my download page
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|