In this article, we will take on a popular programming exercise of counting vowels in a word. You need to write a Java program to count how many vowels in a String, which is entered from the command prompt. It's similar to the program of counting the occurrence of characters in a String, in fact, it's a special case, where you need to count occurrences of all vowels, which includes five characters a, e, i, o and u. We will further use Scanner to get input from the user, as shown in this article. Though I have put down all code inside the main method for quick testing, if you are asked to write this program as part of your homework or during the interview, better writing a method called public int countVowels(String word) and put the logic of counting vowels there. That's a better coding style than writing everything inside the main method.
The difference between RegularEnumSet and JumboEnumSet in Java was asked in a recent Java interview to one of my friend, unfortunately, he hasn't explored this topic well and couldn't answer this question precisely, but he made sure to learn about EnumSet after that. When he discussed this topic to me, I really liked it because, despite the usefulness of EnumSet and it's fast implementation, not many developers know about it, despite being mentioned in Java classic Effective Java. This makes me write this post, where we will mainly discuss a couple of differences between RegularEnumSet and JumboEnumSet in Java, but we will also touch base upon some of the important properties of EnumSet.