class A implements Runnable { Thread t; String s; A(String st) { s=st; t=new Thread(this,s); System.out.println(s+" "+t); t.start(); } public void run() { try { for(int i=5;i>0;i--) { System.out.println(i); Thread.sleep(4000); } } catch(InterruptedException e) { System.out.println(e); } System.out.println("In Run()"); } } public class demo14 { public static void main(String args[]) { A t1=new A("one"); A t2=new A("two"); A o3=new A("three"); System.out.println("In main"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)