public class Palindrome { static boolean isPalindrome(String s){ // terminating condition if(s.length() < 2) return true; // check the 1st and the last chars if(s.charAt(0) == s.charAt(s.length()-1)) return isPalindrome(s.substring(1, s.length()-1)); else return false; } public static void main(String args[]){ if(args.length == 1) System.out.println(args[0]+" is a palindrome? "+isPalindrome(args[0])); } }