01-09-2013, 08:26 PM
This program will ask the person for a password and if they get it right the will be shown some info. Fully commented!
[code2=java]import javax.swing.JOptionPane;
public class password {
public static void password (){
String password = "Potato";//This is the actual password
String input = (JOptionPane.showInputDialog("Insert Password:"));// This is the question asked
if (input.equals(password)){
JOptionPane.showMessageDialog(null, "Access Granted");//If you get it right
JOptionPane.showMessageDialog(null, "This is the information:BLAH BLAH BLAH BLAH BLAH BLAH");//The information
}else{
JOptionPane.showMessageDialog(null, "Access Denied");//If you get it wrong nothing happens
}
}[/code2]
p.s. The password right now is Potato
[code2=java]import javax.swing.JOptionPane;
public class password {
public static void password (){
String password = "Potato";//This is the actual password
String input = (JOptionPane.showInputDialog("Insert Password:"));// This is the question asked
if (input.equals(password)){
JOptionPane.showMessageDialog(null, "Access Granted");//If you get it right
JOptionPane.showMessageDialog(null, "This is the information:BLAH BLAH BLAH BLAH BLAH BLAH");//The information
}else{
JOptionPane.showMessageDialog(null, "Access Denied");//If you get it wrong nothing happens
}
}[/code2]
p.s. The password right now is Potato