There are five vowel characters {a, e, i, o, u}. If the user given character input is one of them that means it is a vowel otherwise it is a consonant.

Logic

Here we have to manually check the given character with all the vowel characters, we cannot use ASCII value range to determine whether it is a vowel or a consonant. The given character can also be in the form of uppercase.

Program

import java.util.Scanner;

public class VovelConsonant {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.println("Enter a alphabet : ");
        char c = scanner.next().charAt(0);

        // if given character is Lower case Vowel or Upper case Vowel
        // then print vowel otherwise consonant
        if ((c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') 
            || (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')) {

            System.out.println(c + " is a vowel.");

        } else{

            System.out.println(c + " is a consonant.");

        }

    }
}

Output

Enter a alphabet : A
A is a vowel.