Hi everyone,
A title said all. i need actually to find a vowel(a,e,i,o,u) in a string.
my code counts how many vowels are in the string that's fine but i need to find a vowel character too..
any idea how to achieve this ?
Here is my code...
import java.io.*; import java.lang.*; public class VowelsExample { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader (new InputStreamReader(System.in)); int count = 0; int i; System.out.println("Enter a string :"); String in = input.readLine(); for (i=0; i<in.length(); i++){ vowel[in.length()] = in.charAt(i); if(vowel[in.length()]=='a' || vowel[in.length()]=='A' || vowel[in.length()]=='e' || vowel[in.length()]== 'E' || vowel[in.length()]=='i' || vowel[in.length()]=='I' || vowel[in.length()]=='o' || vowel[in.length()]=='O' || vowel[in.length()]=='u' || vowel[in.length()]=='U') count ++; } System.out.println("total vowels are : " +count); } }