Java Program:

- To check string is Palindrome or not

Example:

User Input: "aabbaa"

Output: Palindrome String

import java.util.Scanner;
public class PalindromeString {
  public static void main(String []args) {
    String s1,reverse="";
    Scanner userInput = new Scanner(System.in);
    System.out.print("Enter Your string : ");
    s1 = userInput.nextLine();

    int l=s1.length()-1;
    while(l!=-1) {
      reverse+=s1.charAt(l--);
    }

    if(s1.equals(reverse))System.out.println("Palindrome String");
    else System.out.println("Not a Palindrome String");
  }
}

Output:

  Enter Your string : pop
  Palindrome String
Program
string

You must know first,

Palindrome String : if a string & reverse of it are equal then the string is Palindrome string

Example :

String: "aba" & its Reverse = "aba" . so it's Palindrome
String: "abc" & its Reverse = "cba" . so it's NOT a Palindrome

//reverse the string
int l=s1.length()-1;
while(l!=-1) {
  reverse+=s1.charAt(l--);
}

//check for the Palindrome
if(s1.equals(reverse))
Concept

Coming Soon !

Quick
Tutorial

Quote

You cannot have a positive life and a negative mind.