/* * HY335 - Java Thread Example * Fontas Fafoutis (fontas@csd.uoc.gr) */ public class mythread extends Thread { private int id; public mythread(int id){ this.id=id; } @Override public void run(){ for (int j=0;j<20;j++) { try { System.out.println("["+ j + "] I am the thread with id: "+ this.id); Thread.sleep(1); } catch (InterruptedException ex) { System.err.println(ex); } } } }