Given String is Palindrome or not

import javax.swing.JOptionPane;
import java.io.*;
class Pallindrome1
{
public static void main(String[] args) throws IOException
{
String str;
int flag=0;
str=JOptionPane.showInputDialog("enter a string");
     int len=str.length()-1;
for(int i=0;i
{
if(str.charAt(i)!=str.charAt(len))
flag=1;
}
if(flag==0)
JOptionPane.showMessageDialog(null,"it is a pallindrome","Message",JOptionPane.INFORMATION_MESSAGE);
else
JOptionPane.showMessageDialog(null,"it is not a pallindrome","Message",JOptionPane.INFORMATION_MESSAGE);
    }
}

All Rights Reserved The Origin for Screamers | Design by SCREAMERS
Computers
Top Blogs