JAVA PROGRAM 8
JAVA PROGRAM 8: Create 2 threads such that one of thread prints even nos. and another prints odd nos. up to 50. itprofessionalsrocks.blogspot.com class A extends Thread { public void run() { System.out.println("even number from 1 to 50 are given below"); for (int i=1;i<=50;i++) { if(i%2==0) { System.out.println("\n"+i); } } System.out.println("exit from thread a"); } } class B extends Thread { public void run() { System.out.println("odd number from 1 to 50 are given below "); for(int i=1;i<=50;i++) {if(i%2!=0) { System.out.println("\n"+i); } } System.out.println("exit form thread b"); } } class thread { public static void main(String args[]) { A threadA=new A(); B threadB=new B(); System.out.println("Start thread A"); threadA.start(); System.out.println("Start thread B"); threadB.start(); } }