21.1) IMPLEMENT MULTITHREADING TO PERFORM SIMULTANEOUS PROCESSES. PROGRAM: class tdemo extends Thread { public void run() { try { for(int i=10;i>=1;i--) { System.out.println(i); sleep(550); } } catch(Exception e) { System.out.println(e); } } } class tdemo12 extends Thread { public void run() { try { for(int j=1;j<=10;j++) { System.out.println(j);
sleep(500); } } catch(Exception e) { System.out.println(e); } } } class tdemo123 { public static void main(String args[]) { tdemo12 t1=new tdemo12(); t1.start(); tdemo t=new tdemo(); t.start(); } }
OUTPUT: