Question: I * Finish the program below. Write a Java method to check if a given string is a palindrome or not. First convert given string

I*
Finish the program below.
Write a Java method to check if a given string is a palindrome
or not. First convert given string to lower case. Second
if given string is empty or size of one it is alpalindrome wqritas
Lastly, use a loop and two indicescto
second to last characters are the same
The method returns boolean
*/
// Convert the string to lowercase
// Check if the string is empty or has only onelcharacten sulav sht snimq nism al
}
// If the loop completes, the string is a palindrome return true;
public static void printIsPal(String str){
if (isPalindrome(str)){
System.out.print " is a palindrome");
} else {
}
System.out.print " is not a palindrome");
}
public static void main(String[] args){
String str1= "madam";
String str2= "a racecar";
printIsPal(str1);
}
printIsPal(str2);
}
 I* Finish the program below. Write a Java method to check

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