A palindrome is a string that reads the same in both directions. For example, mom, kayak, and
Question:
A palindrome is a string that reads the same in both directions. For example, “mom,” “kayak,” and “avid diva” are all palindromes. Write a recursive method named isPalindrome that determines whether a string is a palindrome. More specifically, your method should return true if the given string parameter (named string) is a palindrome and it should return false otherwise. Use this method signature:
public static boolean isPalindrome(String string)
Within the recursive method, use String’s length method to determine the passed-in string’s length, and just before making a tail-recursive call, use one of String’s substring methods to remove the parameter string’s first and last characters.
Step by Step Answer:
Introduction To Programming With Java A Problem Solving Approach
ISBN: 9781260575248
3rd International Edition
Authors: John Dean