Question: using java please Question is divided into 2 sections: 3.1 3.2 In this question the two sections should be solved with the help of recursion

using java please
Question is divided into 2 sections: 3.1 3.2 In this question the two sections should be solved with the help of recursion and no loops should be used at all! Private methods can be added (without loops).
Note: In this question it is allowed to use the following methods from the String class:
() substring (), length (), charAt. Do not use other methods from this class
. Write a class called Q3 that contains the following two methods (note that there are two sections on this question).
Write a recursive method that has its signature
public static int countLetter (String word, char letter )
The method gets a string and a character and returns how many times a letter appears in a word. The method is case - sensitive - that is, it counts the occurrences of the letter exactly as it appears. That is, if it is a lower case the method will find Only its occurrences as a lower case and if it is an uppercase case the method will only find its occurrences as a uppercase letter.
For example:
word=heLLoO and letter=O the method returns 1
word=heLLoO and the letter is L the method will return 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!