/* * Thread1.java * * Created on March 7, 2006, 4:37 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package headley.chat; /** * * @author Headley WIlliamson */ public class Thread1 extends Thread{ String text; int sleep; /** Creates a new instance of Thread1 */ public Thread1( String p_text, int p_sleep) { text = p_text; sleep = p_sleep; } public void run () { for (int i =0; i <100; i++) { System.out.println(text); try { Thread.sleep(sleep); } catch(Exception ex) { ex.printStackTrace(); } } } public static void main(String [] args) { try{ Thread1 th1 = new Thread1("Thread one running", 1000); Thread1 th2 = new Thread1("Thread two running", 2000); Thread1 th3 = new Thread1("Thread three running", 3000); th1.start(); th2.start(); th3.start(); } catch (Exception ex) { ex.printStackTrace(); } } }