Question: Recursive Method For Recognizing A Palindrome In Java. Your Program Should Do The Following By Modifying The Below Code: Mport Java.Util.Scanner; Recursive method for recognizing

Recursive Method For Recognizing A Palindrome In Java. Your Program Should Do The Following By Modifying The Below Code: Mport Java.Util.Scanner;

Recursive method for recognizing a palindrome in java.

Your program should do the following by modifying the below code:

mport java.util.Scanner;

public class Lab6{

public static void main(String[] args){ /******************************************************** Palindrome */ if (!isaPalindrome("satanoscillatemymetallicsonatas")) System.out.println("You have a bug in your code!"); else System.out.println("check for palidrome ok"); Scanner console = new Scanner(System.in); System.out.print("Input a string >"); String line = console.nextLine(); while (!line.equals("")){ if (isaPalindrome(line)) System.out.println(line+ "is a palindrome"); else System.out.println(line+ "is *not* a palindrome"); System.out.print("Input a string >"); line = console.nextLine(); } }

/** method to determine whether the specified string is a palindrome * @param expr string * @return true if the specified string is a palindrome, otherwise false. */ public static boolean isaPalindrome(String expr){ // TO COMPLETE }

}

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 Programming Questions!