public class MyThread extends Thread { int threadID; // construtor MyThread (int ID) { threadID = ID; } // corpo da thread public void run () { int i ; for (i = 0; i< 100 ; i++) System.out.println ("Hello from t" + threadID + "!") ; } // programa principal public static void main (String args[]) { // cria três threads MyThread t1 = new MyThread (1); MyThread t2 = new MyThread (2); MyThread t3 = new MyThread (3); // inicia as três threads t1.start (); t2.start (); t3.start (); } }