class A implements Runnable { public void run() { for(int i=0;i<5;i++) { try { Thread.sleep(500); System.out.println("Hello"); } catch(Exception e){} } } } class B { public static void main(String... args) { A x=new A(); Thread t1=new Thread(x); t1.start(); } } }