Java Program to Check whethet given String is Palindrome

Get a String and reverse the characters of the string. And check whether reverse order and original order is same.

Sample Input 1:

madam

Sample Output 1:

Palindrome

Program or Solution

				
			
					
//To Check The Given String Is Palindrome...

import java.util.*;

class Program
{
  public static void main(String args[])
  {
    String str,str1="";
    int i;

   Scanner sc=new Scanner(System.in);

   System.out.println("Enter The String:");
   str=sc.next();

   int len=str.length();
   for(i=len-1;i>=0;i--)
    {
        str1=str1+str.charAt(i);
    }

  System.out.println("The Reversed String Is:"+str1); 
  if(str.equals(str1))
    {
        System.out.println("This Is Palindrome...");
    }  
 else
  {
       System.out.println("Not A Palindrome...");
  }

   }
}
			
				
			

Program Explanation

Comments

ubaTaeCJ
-1 OR 2+111-111-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3+111-111-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3*2<(0+5+111-111) --
ubaTaeCJ
-1 OR 3*2>(0+5+111-111) --
ubaTaeCJ
-1 OR 2+393-393-1=0+0+0+1
ubaTaeCJ
-1 OR 3+393-393-1=0+0+0+1
ubaTaeCJ
-1 OR 3*2<(0+5+393-393)
ubaTaeCJ
-1 OR 3*2>(0+5+393-393)
ubaTaeCJ
-1' OR 3+581-581-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3*2<(0+5+581-581) --
ubaTaeCJ
-1' OR 3*2>(0+5+581-581) --
ubaTaeCJ
if(now()=sysdate(),sleep(15),0)
ubaTaeCJ
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
ubaTaeCJ
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
ubaTaeCJ
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
ubaTaeCJ
-1; waitfor delay '0:0:15' --
ubaTaeCJ
-1); waitfor delay '0:0:15' --
ubaTaeCJ
1 waitfor delay '0:0:15' --
ubaTaeCJ
raL7PI2W'; waitfor delay '0:0:15' --
ubaTaeCJ
-5 OR 746=(SELECT 746 FROM PG_SLEEP(15))--
ubaTaeCJ
-5) OR 383=(SELECT 383 FROM PG_SLEEP(15))--
ubaTaeCJ
-1)) OR 88=(SELECT 88 FROM PG_SLEEP(15))--
ubaTaeCJ
M2TckASZ' OR 576=(SELECT 576 FROM PG_SLEEP(6))--
ubaTaeCJ
kXpyjt8q') OR 76=(SELECT 76 FROM PG_SLEEP(15))--
ubaTaeCJ
cSkdLZ6r')) OR 180=(SELECT 180 FROM PG_SLEEP(15))--
ubaTaeCJ
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
ubaTaeCJ
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
ubaTaeCJ
1'"
ubaTaeCJ
@@Fp2NY