1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/* Listing2202.java */ class MyThread2202 extends Thread { public void run() { int i = 0; while (true) { System.out.println(i++); } } } public class Listing2202 { public static void main(String[] args) { MyThread2202 t = new MyThread2202(); t.start(); try { Thread.sleep(2000); } catch (InterruptedException e) { //nichts } t.stop(); } }