Program 19.6: Sleepy BytePrinter

Program 19.6 is revised BytePrinter that sleeps for one second between every byte it prints.
public class BytePrinter extends Thread {

  public void run() {
    for (int b = -128; b < 128; b++) {
      System.out.println(b);
      try {
        sleep(1000);
      }
      catch (InterruptedException e) {
  
      }
    }
  }
  
}

Copyright 1996 Elliotte Rusty Harold
elharo@sunsite.unc.edu
This Chapter
Examples
Home