http://www.jguru.com/faq/view.jsp?EID=41903


John Zukowski

Creating a thread involves creating a new Thread and invoking its start() method. Calling start()causes the run() method of the Thread subclass or the Runnable object passed to the Threadconstructor to execute.


Thread t1 = new Thread() {
  public void run() {
    for (int i=0; i<100; i++) {
      System.out.println("Tastes Great");
    }
  }
};

Runnable r = new Runnable() {
  public void run() {
    for (int i=0; i<100; i++) {
      System.out.println("Less Filling");
    }
  }
};
Thread t2 = new Thread(r);

t1.start();
t2.start();