Hi All-
I was thinking that destroy method will be automatically called after completetion of run() method. But it is not working that way. Wondering what is recommended way for stopping/destroying
thread after completion.
public class ThreadClass extends Thread {
/**
* Constructor for ThreadClass.
*/
public ThreadClass() {
super();
}
public static void main(
String[] args) {
}
public void run() {
System.out.println("In run Method") ;
}
public void destroy() {
System.out.println("In destroy Method") ;
}
}
public class MainClass {
/**
* Constructor for MainClass.
*/
public MainClass() {
super();
}
public static void main(String[] args) {
ThreadClass TC = new ThreadClass();
TC.start();
}
}