class CountThread extends Thread { int maxcount; CountThread(int maxcount) { this.maxcount = maxcount; } public void run() { for (int count = 1; count < maxcount; count++) { System.out.println("The count is " + count + "."); try{ sleep(1000); } catch (InterruptedException e) { return; } } //end for loop } } //END CLASS - COUNT THREAD class ThreadApp { public static void main (String args[]) { CountThread theCounter = new CountThread(8); theCounter.start(); while(theCounter.isAlive()) { System.out.println("counting..."); try{ Thread.sleep(1000); } catch (InterruptedException e){ return; } } //END -- while loop } } //END CLASS - THREAD APP