Write a program to check string is palindrome or not
Write a simple program to check given string is palindrome or not. This is very simple but it frequent asked in interview for freshers. public class StringPalindrome { public static void main(String[] args) { String input = "abcdcba"; boolean isPalindrome = isPalindrome(input); System.out.println(isPalindrome); } private static boolean isPalindrome(String input){ for (int i = 0; i < input.length()/2; i++) { if(input.charAt(i) != input.charAt(input.length()-i-1)){ return false; } } return true; } }