
display all the vowel from word/string

import java.util.*;
class DisplayVowels
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter word/string:");
String str=input.nextLine();
String vowels="";
char ch[]=str.toCharArray();
for(int i=0;i<ch.length;i++){
if(ch[i]=='a'||ch[i]=='e'||ch[i]=='i'||ch[i]=='o'||ch[i]=='u'){
vowels+=Character.toString(ch[i])+" ";
}
}
System.out.println("Vowels in the string: "+vowels);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.