public class Head{ public static void main(String[] args){ int counter = 0; Thread current = Thread.currentThread(); ThreadOne one = null; RunnableTwo two = null; boolean alive = true; while(alive){ try { current.sleep(1000); } catch(InterruptedException ie) {} if (counter == 0){ System.out.println("Creating and starting thread 1\n"); one = new ThreadOne(); }else if (counter == 5){ System.out.println("\nCreating and starting thread 2\n"); two = new RunnableTwo(); }else if (counter == 10){ two.pause(); System.out.println("\nPausing thread 2\n"); }else if (counter == 15){ System.out.println("\nRestarting thread 2\n"); two.restart(); }else if (counter == 20){ one.kill(); System.out.println("\nKilling thread 1\n"); }else if (counter == 25){ two.kill(); System.out.println("\nKilling thread 2"); alive = false; } counter++; } } }