Palindrome - int length = word.length if(length<=1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Palindrome{ public static void main(String[ ] args){ System.out.println(checkPalindrome(args[0])); } public static boolean checkPalindrome(String word){ System.out.println(word);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int length = word.length(); if(length<=1){ return true; } else return (word.charAt(0)==word.charAt(length-1)) && checkPalindrome(word.substring(1,length-1)); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online