Texts: Answer must be in JAVA
Exercise 4
Methods Exercise 4
Write a method called isPalindrome() 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 Exercise4 {
//add code below this line
//add code above this line
public static void main(String args[]) {
String x = args[0];
System.out.println(isPalindrome(x));
}
}
Hint Requirements
You should not make any changes to the code that already exists. If you accidentally delete any existing code, you can copy and paste the entire program from above.
You can use any number of methods, loops, and/or conditionals to produce the desired output.
Compile and test your code with a few different values
The button below will compile and test the code with "Level". COMPILE AND TEST
Expected Output
The button below will compile and test the code with "anna". COMPILE AND TEST
Expected Output
The button below will compile and test the code with "022220". COMPILE AND TEST
Expected Output
The button below will compile and test the code with "10". COMPILE AND TEST
Expected Output
Methods: Exercise 4
When your code is ready, click the button below to submit your work for grading.
Check It! (1 left)