Multiple threads
The following program launches three BytePrinter 
threads:
public class ThreadsTest {
  public static void main(String args[]) {
  
    BytePrinter bp1 = new BytePrinter();
    BytePrinter bp2 = new BytePrinter();
    BytePrinter bp3 = new BytePrinter();
    bp1.start();
    bp2.start();
    bp3.start();
      
  }
}
The order of the output you see from this program is implementation dependent,
and mostly unpredictable. It may look something like this:
-128
-127
-126
...
125
126
127
-128
-127
-126
...
125
126
127
-128
-127
-126
...
125
126
127
In this case the three threads run sequentially, one after the other. 
However on a few systems you may see something different
Previous | Next | Top
Last Modified December 2, 1997
Copyright 1997 Elliotte Rusty Harold
elharo@metalab.unc.edu