Write a JAVA program which will create two child thread by implementing Runnable interface ; one thrade will print even numbers from 1-50 andother will display vowels.
import java.io.*; class even implements Runnable { public void run() { for(int i=1;i<=50;i++) { if(i%2==0) System.out.println("Even no:"+i); }}} class vowel implements Runnable { public void run() { try { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the String:"); String data=br.readLine(); int n1=data.length(); char p[]=data.toCharArray(); System.out.println("Vowel is:"); for(int i=0;i { if(p[i]=='a'||p[i]=='e'||p[i]=='i'||p[i]=='o'||p[i]=='u') System.out.println(p[i]); }} catch(Exception e) {} }} class slip17 { public static void main(String args[]) { try { even e1=new even(); Thread tx1=new Thread(e1); tx1.start(); tx1.sleep(100); vowel v1=new vowel(); Thread tx2=new Thread(v1); tx2.start(); } catch(Exception e) {} }}
Write a JAVA program which will create two child thread by implementing Runnable interface ; one thrade will print even numbers from 1-50 andother will display vowels.
Reviewed by
on
April 27, 2015
Rating: