ThreadExt.java
/*
* Copyright@ 2011 www.egtry.com
*/
package egtry.thread;
///create a thread object by extends Thread
public class ThreadExt extends Thread {
public static void main(String[] args) {
System.out.println("Main Thread at the beginning: "+Thread.currentThread().getId());
ThreadExt t1=new ThreadExt();
t1.start();
System.out.println("Main Thread at the end: "+Thread.currentThread().getId());
}
@Override
public void run() {
System.out.println("Thread started");
System.out.println("Child Thread: "+Thread.currentThread().getId());
}
}