Question
a- Write a complete Java program that includes a recursive java method countChar that takes a character and a string as arguments and finds the
a- Write a complete Java program that includes a recursive java method countChar that takes a character and a string as arguments and finds the number of occurrences of that character in the string. You should include in your answer a screenshot that shows the program and the output provided that the given character s should be equal to your first name initial letter, and the string should be your name (consider all characters are lower case). For example, if your name is abdallah, then a is the char and abdallah is the string that should be used.
b- Using the above method, show all the recursive steps (composition and decomposition),if we call countChar('s', "Sessions").
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started