The Java Program: Count.java
1
2
3 public class Count implements Runnable {
4 private int maxcount;
5
6 Count (int maxcount) {
7 this.maxcount = maxcount;
8 }
9
10 public void run () {
11 Thread t = Thread.currentThread();
12 for (int count=1; count<=maxcount; count++) {
13 System.out.println (count + " " + t.getName());
14 }
15 System.out.println ("DONE! " + t.getName());
16 }
17
18 public static void main (String args[]) {
19 for (int i=0; i<args.length; i++) {
20 new Thread (new Count (Integer.parseInt(args[i]))).start();
21 }
22 }
23 }