Question: Write a method called isPalindrome ( ) in java that takes a string as a parameter. If the string is a palindrome ( a word
Write a method called isPalindrome in java that takes a string as a parameter.
If the string is a palindrome a word that is spelled the same forward and backward then the method will return a boolean of true.
If the string is not a palindrome, then false is returned.
Note that capitalization matters. For example, "Level" would not be considered a palindrome because uppercase L and lowercase l are not the same.
Existing Code:
import java.util.;
public class Exercise
add code below this line
add code above this line
public static void mainString args
String x args;
System.out.printlnisPalindromex;
Hint
Consider creating a new empty string and populating it with characters of the specified string in reverse order.
Then check the two strings for equality.
Remember that the method should return a boolean, therefore, you should declare a boolean variable and have that boolean change based on certain conditions.
Then return that variable.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
