Extend the Thread class and override the run method to create a simple thread.
Source Code
class HelloThread extends Thread {
public void run() {
System.out.println("Hello from a thread!");
}
}
public class TestThread {
public static void main(String[] args) {
(new HelloThread()).start();
}
}