STRINGS

17. Program to determine whether a given string is palindrome

class Main{
            static boolean isPallindrome(String str){
                for(int i = 0, j = (str.length()-1); i < j; i++, j--){
                    if(str.charAt(i) != str.charAt(j)){
                        return false;
                    }
                }
                return true;
            }
            public static void main(String[] args){
                System.out.println((isPallindrome("abc11cba")) ? "pop is pallindrome" : "pop is not pallindrome");
                System.out.println((isPallindrome("39d")) ? "hey is pallindrome" : "hey is not pallindrome");
            }
        }

OUTPUT

            pop is pallindrome
            hey is not pallindrome