Write a program to check if an input String is Palindrome or not?

import java.util.Scanner;

class Palindrome {

	String str;
	Scanner scan;

	void getValue() {

		scan = new Scanner(System.in);
		System.out.println("Check Palindrome String or not");
		System.out.println("\nEnter a String :");
		str = scan.nextLine();

	void palindromeString() {
		boolean isPalindromeString = true;
		if (str == null) {
			isPalindromeString = false;
		} else {
			int length = str.length();
			for (int i = 0; i < length / 2; i++) {

				if (str.charAt(i) != str.charAt(length - i - 1))
					isPalindromeString = false;
		if (isPalindromeString)
			System.out.println(str + " is a Palindrome String");
			System.out.println(str + " is a  not a Palindrome String");


public class MainClass {

	public static void main(String args[]) {

		Palindrome obj = new Palindrome();


Check Palindrome String or not Enter a String : abcdcba abcdcba is a Palindrome String Enter a String : hello hello is a not a Palindrome String

Related Examples

Write a program to get list of all the files from a given directory?
Write a Comparator to compare students based upon their name and age?
Simple Array Sorting Program.
Bubble Sort Example.
Write a java program to check if a number is Armstrong number or not?

Receive Latest Java Examples in Your Email: