class example { public static void main(String[] a) { // alternative 1 ExtnOfThread t1 = new ExtnOfThread(); t1.start(); // alternative 2 Thread t2 = new Thread (new ImplOfRunnable()); t2.start(); } } class ExtnOfThread extends Thread { public void run() { System.out.println("Extension of Thread running"); // next line compiles and runs just fine try {sleep(1000);} catch (InterruptedException ie) {return;} } } class ImplOfRunnable implements Runnable { public void run() { System.out.println("Implementation of Runnable running"); // next line will not compile - thread method sleep() not known // try {sleep(1000);} // catch (InterruptedException ie) {return;} // do it like this Thread t = Thread.currentThread(); try { t.sleep(1000); } catch (InterruptedException ie) { return; } } }