class A extends Thread { public void run() { try { for(int i=1;i<=5;i++) { System.out.println("okay boss"); Thread.sleep(1000); } } catch(Exception m) { System.out.println("some eror"); } } } class F { public static void main(String[] args) { A r= new A(); r.start(); r.interrupt(); } }