GreetingRunnable - for (int i = 0 ; i <...

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

View Full Document Right Arrow Icon
import java.util.Date ; public class GreetingRunnable implements Runnable { private String greeting ; private static final int INTERVAL = 1000 ; private static final int ITERATIONS = 10 ; public GreetingRunnable(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 &lt; ITERATIONS ; i++) { System.out.println(i + &quot;. &quot; + greeting + &quot; &quot; + new Date() ) ; Thread.sleep(INTERVAL) ; } } catch (InterruptedException ie) { System.out.println(&quot;Thread &quot; + greeting + &quot; signing off.&quot;) ; } } }...
View Full Document

Ask a homework question - tutors are online