// Concurrent Programming - CS 498-598
// Summer 2002 - A simple, threads-runnable program.

// Define a Runnable that implement whatever task needs to be done.

class
FriendlyRunnable 
implements Runnable {

  public void
  run() {
    System.out.println("Hello world!");
    }
  }


class 
HiRunnable {

  public static void 
  main(String[] args) {
    big();
    little();
    }

  // Execute the Runnable in a Thread in the usual over-wrought Java way.

  private static void 
  big() {
    FriendlyRunnable friendlyRunnable = new FriendlyRunnable();
    Thread friendlyThread = new Thread(friendlyRunnable);
    friendlyThread.start();
    }

  // Do the same thing as the previous function, except a bit more conciesely.
  // You should probably use a style midway between the styles illustrated by
  // these two functions.

  private static void 
  little() {
    (new Thread(new FriendlyRunnable())).start();
    }
  }


syntax highlighted by Code2HTML, v. 0.9