<<< Example: IOTask class implementing the Runnable interface | Index | Thread interruption >>> |
public class Main { public static void main(String[] args) { Thread ct = Thread.currentThread(); System.out.println(ct.getName() + " started."); // create the new thread Thread worker = new Thread( new IOTask() ); // start the new thread worker.start(); System.out.println(ct.getName() + " starts " + worker.getName() + "."); System.out.println(ct.getName() + " finished."); } }//class Main
<<< Example: IOTask class implementing the Runnable interface | Index | Thread interruption >>> |