GreetingThread - for(int i = 0 i< ITERATIONS i...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/** Simple test of thread (from Horstmann) */ import java.util.Date ; public class GreetingThread extends Thread { private String greeting ; private static final int INTERVAL = 1000 ; private static final int ITERATIONS = 10 ; public GreetingThread(String greet) { greeting = greet ; } public void run() { try { //for (int i = 0 ; i < ITERATIONS & !isInterrupted() ; i++) {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for (int i = 0 ; i < ITERATIONS ; i++) { System.out.println(i + ". " + greeting + " " + new Date() ) ; sleep(INTERVAL) ; } } catch (InterruptedException ie) { System.out.println("Thread " + greeting + " signing off.") ; } } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online