is char Consonant - Java java.lang

Java examples for java.lang:char

Description

is char Consonant

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        char c = 'a';
        System.out.println(isConsonant(c));
    }//www  .  ja v a2 s.c o m

    static boolean isConsonant(char c) {
        return !isVowel(c);
    }

    static boolean isVowel(char c) {
        return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'
                || c == 'y' || c == 'A' || c == 'E' || c == 'I' || c == 'O'
                || c == 'U' || c == 'Y';
    }
}

Related Tutorials