public class Counter1 extends Thread
1:
2: public class Counter1 extends Thread {
3:
4: protected int count;
5: protected int inc;
6: protected int delay;
7:
8: public Counter1( int init, int inc, int delay ) {
9: this.count = init;
10: this.inc = inc;
11: this.delay = delay;
12: }
13:
14:
15: public void run() {
16: try {
17: for (;;) {
18: System.out.print(count + " ");
19: count += inc;
20: sleep(delay);
21: }
22: } catch (InterruptedException e) {}
23: }
24:
25: public static void main(String[] args) {
26: new Counter1(0, 1, 33).start();
27: new Counter1(0, -1, 100).start();
28: }
29: }