Well,
here is a little programm that works pretty well. Note that the
sleep part is to allow other Threads to take over the cpu for a while.
There are other ways to achieve this, but this one is, to my opinion, the
simplest one:
import java.awt.*;
public class test implements Runnable {
private String strg;
Thread runner;
test(String strg) {
this.strg = strg;
}
public void start() {
if(runner == null) {
runner = new Thread(this);
runner.start();
}
}
public void stop() {
if(runner != null) {
runner.stop();
runner = null;
}
}
public void run() {
while(true) {
System.out.println(this.strg);
try {
Thread.sleep(1);
} catch(Exception e) {
}
}
}
public static void main(String[] args) {
test tst1 = new test("Foo");
test tst2 = new test("bar");
tst1.start();
tst2.start();
}
}
Hope this helps...
Papi
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]