Some Related Applications

Finding out if a given character (maybe anything in upper or lower case) is a vowel or consonant. 

Implementation is given below: 

Java




class Vowels {
    // function to check if the passed
    // character is a vowel
    public static boolean vowel(char c)
    {
        return "aeiouAEIOU".indexOf(c) >= 0;
    }
 
    // Driver program
    public static void main(String[] args)
    {
        boolean isVowel = vowel('a');
 
        // Printing the output
        if (isVowel)
            System.out.println("Vowel");
        else
            System.out.println("Consonant");
    }
}


Output

Vowel


Java String indexOf()

In Java, String indexOf() method returns the position of the first occurrence of the specified character or string in a specified string.

Similar Reads

Variants of indexOf() Method

There are four variants of the indexOf() method are mentioned below:...

Some Related Applications

...