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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: