Yurttas/PL/OOL/Java/F/07/02/R01.java

From ZCubes Wiki
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 R01 {
16
17  public static void main(String[] args) {
18    int delay1,
19        delay2;
20
21    switch(args.length) {
22      case 2 : delay1 = Integer.parseInt(args[0]);
23               delay2 = Integer.parseInt(args[1]);
24               break;
25      default: delay1 = 10;
26               delay2 = 60;
27    }
28
29    R runnable1 = new R("Thread 1",
30                        delay1);
31    R runnable2 = new R("            Thread 2",
32                        delay2);
33
34    Thread thread1 = new Thread(runnable1);
35    Thread thread2 = new Thread(runnable2);
36
37    thread1.start();
38    thread2.start();
39  }
40
41}