Java Code For String Pallindrome:

    

 Java Code  For String   Pallindrome  Using CharAt( ):
=========================================

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String s, ns;
 int n, i;
 ns = "";

s=tf1.getText();
n=s.length();
for(i=n-1;i>=0;i--)
    ns=ns+s.charAt(i);
if (ns.equals(s))
{JOptionPane.showMessageDialog(this, "The word is a pallendrome");

}
else {
JOptionPane.showMessageDialog(this,"The word is not a pallendrome");
}
}

GUI  Interface >>


Message Pops Up When Word is a Pallindrome>>



You can Refer   Here  For  My Java Code On Reverse Strings:


  

No comments:

Post a Comment