Java Program to Check Whether an Alphabet is Vowel or Consonant - safetxt
avatar
Java Program to Check Whether an Alphabet is Vowel or Consonant

mrt481 4K 28th Aug, 2022

Java 0.33 KB
Loading Please wait...
Description

In the above program, 'i' is stored in a char variable ch. In Java, you use double quotes (" ") for strings and single quotes (' ') for characters. Now, to check whether ch is vowel or not, we check if ch is any of: ('a', 'e', 'i', 'o', 'u'). This is done using a simple if..else statement. We can also check for vowel or consonant using a switch statement in Java.


Recent Pastes

Please disable your adblock and script blockers to view this page