Yurttas/PL/OOL/Java/F/07/03/T02.java
Jump to navigation
Jump to search
1/**
2 * Copyright(C) 1998
3 * All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4 *
5 * Permission to use, copy, modify, and distribute this
6 * software and its documentation for EDUCATIONAL purposes
7 * and without fee is hereby granted provided that this
8 * copyright notice appears in all copies.
9 *
10 * @date : January 1, 1998.
11 * @author : Salih Yurttas.
12 */
13
14
15public class T02 {
16
17 public static void main(String[] args) {
18 final NotifyUtil notifyObject = new NotifyUtil();
19
20 Runnable sleeper= new Runnable() {
21 public void run() {
22 notifyObject.waitToProceed();
23 }
24 };
25
26 Runnable waker= new Runnable() {
27 public void run() {
28 notifyObject.proceed();
29 }
30 };
31
32 Thread sleeperThread = new Thread(sleeper,"sleeper");
33 sleeperThread.start();
34
35 try {
36 Thread.sleep(2000);
37 }
38 catch(InterruptedException sleepExcept) {}
39
40 Thread wakerThread = new Thread(waker);
41 wakerThread.start();
42 }
43
44}