Program for checking given string is "Palindrome" or not.

Program for checking given string is "Palindrome" or not.


Description: - 

This programs returns true if given string is "Palindrome" else it will return false.


Code:- 


public static boolean isPalindrom(String str) {

    char[] arr = str.toCharArray();
    String ans = "";

    for(int i=arr.length-1;i>=0;i--){

        ans+=arr[i];

    }

    if(str.equals(ans)){
        return true;
    } else {
        return false;
    }
}


Feedback:-


After reading this page if you have any feedback do let me know in comments; i will try to bring those things in my upcoming posts.















Comments

Popular Posts