Monday, November 11, 2013 - 6:10pm

There are no lack of formal definition of thread. Neither is confusion.
I would like to introduce a rather informal, friendly one of mine. Thread is a way to run multiple computer programs at the same time. We would need some more qualifiers to make the "definition" complete, which we'll do in class.

import java.util.logging.Logger;

public class HelloThread extends Thread {

    public void run() {
        for(int i=0;i< 20;i++){
            System.out.println("ExtraThread: " + i);
        }
    } 
    public static void main(String[] args) {
        HelloThread t = new HelloThread();
        t.start(); // vs t.run();
        for(int i=0;i< 20;i++){
            System.out.println("MainThread: " + i);
        }
        
    }
}