/**
* @(#)password.java
*
*
* @author
* @version 1.00 2012/7/14
*/
import javax.swing.JOptionPane;
import javax.swing.*;
import java.util.*;
public class password {
public static void main (String[] args)
{
String user;
user=JOptionPane.showInputDialog("enter password to continue(letter only)");
if(user.compareTo("adnan"))
{
JOptionPane.showMessageDialog(null,"ACCES GRANTED","welcome",
JOptionPane.INFORMATION_MESSAGE);
}
else
{
JOptionPane.showMessageDialog(null,"ACCES DENIED","error",
JOptionPane.ERROR_MESSAGE);
}
}
}
adnan18
0
Newbie Poster
Recommended Answers
Jump to Postfirst of all, you don't actually ask a question, but, having taken a glimpse at your code, I can figure out what your problem is:
if(user.compareTo("adnan"))
something tells me this is not what you want to do. compareTo is actually used to sort
elements. the above …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.