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...

Which of the following are member functions of the queue adaptor template? For members of queue, specify any needed arguments.

a) size() b) empty() c) top() d) front() e) push() f) back() g) pop() h) == (i.e., overloaded operator==)

Computer Science & Information Technology

Define router flapping.

What will be an ideal response?

Computer Science & Information Technology

List three kinds of errors a writer should search for during the final proofreading of a document.

What will be an ideal response?

Computer Science & Information Technology

To replace, move, copy, or delete text, you need to select it first. 

Answer the following statement true (T) or false (F)

Computer Science & Information Technology