Write a method called isPalindrome that accepts a String as a parameter and returns true if the String is a palindrome, and false otherwise. You may assume that the entered String consists entirely of lowercase letters (meaning it contains no numbers, spaces, punctuation, etc). Hint: write code that creates a new string that is the original string reversed, and then check to see if the two strings are equal.
What will be an ideal response?
```
public boolean isPalindrome(String s) {
String reverseS = new String("");
for(int i = s.length()-1; i >= 0; i--)
reverseS += s.charAt(i);
return reverseS.equals(s);
}
```
Computer Science & Information Technology
You might also like to view...
Where is the Show Formulas command found?
A) Formula Auditing group on the Formulas tab B) Formula Auditing group on the Data tab C) Formula Auditing group on the Developer tab D) Formula Auditing group on the Review tab
Computer Science & Information Technology
You can set up accounts on your computer for multiple users who must share the same password.
Answer the following statement true (T) or false (F)
Computer Science & Information Technology