How to check if an input character is a vowel
In this blog post, I will be demonstrating how you can check if an input character is a vowel. I will be using Enum for this. If you’d like to study enums in detail, you can refer to this blog post. Consider the following code snippet: public enum Vowels {a,e,i,o,u;}public class CheckIfVowel {public static void main(String[] args) {System.out.println("Enter a character:");Scanner scanner = new Scanner(System.in);String input = scanner.nextLine();boolean found = false;for(Vowels vowel:Vowels.values()){if (vowel.name().equalsIgnoreCase(input)){found = true;break;}}if(!found) System.out.println("Input "+input +" is NOT a vowel");else System.out.println("Input "+input +" is a vowel");scanner.close();}} Code explanation First, the code declares an Enum called Vowels . It is assigned the vowels i.e. a,e,i,o,u . We are using the CheckIfVowel class to check if the input character is a vowel. The input character is read using ...