multi threading in java
Hello Everyone, Please review this program and suggest. It is working as expected. class Loader extends Thread { public void run() { System.out.println("in Loader program"); try{ Thread.sleep(1000); System.out.println("end of Loader class"); } catch(Exception e){ System.out.println("IE!"); } } } class Loader1 implements Runnable { public void run() { System.out.println("in loader1 class"); System.out.println("end of loader1"); } } class MyClass { public static void main(String[ ] args) { Loader obj = new Loader(); System.out.println("Loader class object [obj] is created & calling start on obj of Loader class"); obj.start(); System.out.println("called start on obj of Loader class and it is in progress"); Thread obj1 = new Thread(new Loader1()); System.out.println("Loader1 object [obj1] is created and calling start menthod on obj1 of Loader1 class"); obj1.start(); System.out.println("called start on obj1 of Loader1 class and it is in progress"); } } output: Loader class object [obj] is created & calling start on obj of Loader class called start on obj of Loader class and it is in progress Loader1 object [obj1] is created and calling start menthod on obj1 of Loader1 class called start on obj1 of Loader1 class and it is in progress in Loader program in loader1 class end of loader1 end of Loader class