PDA

Click to See Complete Forum and Search --> : password if condition


JXDOS
Oct 21st, 2006, 07:16 AM
hi all.
I am new to java and i want to make a message text box asking for the pass word. if the password is correct then messagebox title and text = welcome else = access denied

this is what i have put together myself but it doesn't work..

import javax.swing.JOptionPane;

public class Password
{
public static void main(String args[])
{
String name =
JOptionPane.showInputDialog("Password?");
if:
{
raw_input = "hello";
String message =
String.format("Welcome");

JOptionPane.showMessageDialog("Welcome");
}
else:
{
String message =
String.format("Access Denied");

JOptionPane.showMessageDialog("Access Denied")

}

}
}

CornedBee
Oct 21st, 2006, 08:42 AM
Perhaps you should find out how if and else really work. I recommend a tutorial or beginner's book.

ComputerJy
Oct 21st, 2006, 06:20 PM
Just like CornedBee said, you won't learn much by only asking questions. Learning from a book is the best way