Write a program that use a recursive method to check whether a string is a palindrome.this my code
Code:
public class Palindrome {
void main(String[] args) {
// TODO code application logic here
char charArray[] = args[0].toCharArray();
}
public static Boolean testPalindrome(char[] text, int beg, int end) {
//First case: the fragment in question is empty
//This will be the case if beg is > end
if(beg > end)
return true;
//Second case: the fragment contains just one character
//This will be the case when beg == end.
if(beg == end)
return true;
//Third case: is it of the form "x" + s + "x"
if(testPalindrome(??, ?, ?))
else
return false;
}
}
Comment