Java Thread Test
// Ttest1.java
// it contains a test java program, that defines a class jtest with
// a main function that prints howdy, and creates threads from the
// class Thread1.java
// compile this file with the command "javac Ttest1.java"
// your path must include the bin directory of the jdk
// run the program with "java Ttest2"
// on some systems
class Ttest1 {
public static void main(String argv[]) {
System.out.println("Howdy");
new Thread1();
}
}
// Thread1.java
// It is a thread class to be run from Ttest2
// compile this file with the command "javac Thread1.java"
// your path must include the bin directory of the jdk
public class Thread1 extends Thread {
Thread1() { //constructor - executed when thread is created with new
start(); // by default calls method "run"
}
public void run() {
System.out.println("Howdy from the thread");
}
}