Write a recursive Java method that takes a String as a parameter and returns true if the String is a palindrome. You may assume that the string only contains lower case characters (i.e. no numbers, spaces, punctuation, etc).

What will be an ideal response?


```
public boolean isPalindrome(String s) {
if(s.length() == 1)
return true;
else if(s.length() == 2 && s.charAt(0) == s.charAt(1))
return true;
else if(s.charAt(0) == s.charAt(s.length() – 1))
return isPalindrome(s.substring(1, s.length() - 1));
else
return false;

}
```

Computer Science & Information Technology

You might also like to view...

Data recovery ____ provide a hardware and software environment that is compatible with the conditions of the primary site, as well as the most recent backup of the data.

A. coldsites B. warmsites C. hotsites D. procedures

Computer Science & Information Technology

What is a master item? Give some common examples of master items in use.

What will be an ideal response?

Computer Science & Information Technology

Which of the following are formatting symbols?

A. dollar sign ($) B. comma (,) C. pound sign (#) D. percent sign (%)

Computer Science & Information Technology

_____ is a percentage rate that compares the total net benefits received from a project to the total costs of the project.

A. Net present value (NPV) B. An acquisition process C. Return on investment (ROI) D. Payback analysis

Computer Science & Information Technology