Question: Write a method that uses recursion to count the number of times a specific letter occurs in a string using the following method header: public

Write a method that uses recursion to count the number of times a specific letter occurs in a string using the following method header: public static int charCount(String str, char ch). For example, charCount(Welcome, 'e') returns 2. Use a helper method with the following header: public static int charCount(String str, char ch, int high) where high represents an index of the string, to improve the algorithm's performance. Demonstrate the method with a driver program called CharacterCounter, that prompts the user to enter a string (i.e., This is the string"), and then a character, and then displays the number of occurrences of the character in the string
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
