From the course: Nail Your Java Interview

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Challenge: Counting characters with string manipulation

Challenge: Counting characters with string manipulation - Java Tutorial

From the course: Nail Your Java Interview

Start my 1-month free trial

Challenge: Counting characters with string manipulation

(upbeat music) - [Instructor] It's time for some more string manipulation practice. In this challenge, you'll create a program that finds the number of vowels and consonants in a given string. You'll create a method that takes a string input and prints out the number of vowels and the number of consonants in that string input. We can assume that the string will contain only letters and white space. As a reminder, the letters A, E, I, O, U, and Y are considered vowels. For this challenge, you might want to keep the toCharArray and charAt methods in mind. Here are some example test cases you should try. Feel free to test your algorithm with other strings as well. Good luck!

Contents