Shutdown thread
import java.io.IOException;
class MyThreads implements Runnable{
@Override
public void run() {
System.out.println("I am shutting down");
}
}
public class AnasShutDown {
public static void main(String[] args) {
Thread myThread = new Thread(new MyThreads());
Runtime.getRuntime().addShutdownHook(myThread);
try {
Runtime.getRuntime().exec("notepad");
} catch (IOException e) {
e.printStackTrace();
}
System.exit(0);
}
}