// Copyright © 2002 // John M. Thompson // Boulder, Colorado USA // jt@iwaypublishing.com // http://www.iwaypublishing.com // // A limited right to copy this page for // individual (non-commercial) educational // use only is hereby granted. public class sampleThread extends Thread { private String name_ = null; private int sleepMillis_ = 0; /******************************************************************/ public sampleThread( String name, int sleepMillis ) { name_ = name; sleepMillis_ = sleepMillis; } /******************************************************************/ public void run() { System.out.println( "\nThread " + name_ + " going to sleep for " + sleepMillis_ + " milliseconds." ); try { Thread.sleep( sleepMillis_ ); } catch( InterruptedException e ) {} System.out.println( "\nThread " + name_ + " woke up." ); return; } }