Question
3.5 Learning Objective: To write a recursive method. Instructions: See the instructions in 1.1 for what to submit for grading. This is not a complete
3.5 Learning Objective: To write a recursive method. Instructions: See the instructions in 1.1 for what to submit for grading. This is not a complete program. Name your class H03_35 and save it in a file named H03_35.java. When you are done, copy H03_35.java to your asuriteid-h03 folder, i.e., to the same folder as the PDF. Problem: Write a recursive method String reverse(String s) that returns the reverse of s. For example, if s is "Hello world" then the method shall return "dlrow olleH". Hint: The base case occurs when the length of your string is 1. Otherwise, remove the first character c at index 0 of s forming a substring t which consists of the characters of s at indices 1, 2, 3, ..., s.length() - 1. Then, concatenate the reverse of t and c and return this new string. Note that the reverse of the empty string "" is the empty string.Testing: We will be testing your method using our driver routine. For testing on your end, write your own driver routine in a class different than H03_35
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