Question: 6. Write a recursive method using the header below to count the number of times the character parameter c appears in the String parameter s.

6. Write a recursive method using the header below to count the number of times the character parameter c appears in the String parameter s. Note that the parameters may be the empty string "", which contains c 0 times. String methods you will probably find useful: charAt(i) //returns the character at index i of the string substring(a) //returns the portion of the string from index a to the end of the string You may also use other String methods from the AP Quick Reference as necessary. public static int count(String s, char c) {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
