Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Password Program
#1
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
#2
what's the difference between joptionpane and system.out.println?
#3
andrei.xd23 Wrote:what's the difference between joptionpane and system.out.println?
JOptionPane pops up with a dialog box whereas System.Out.Println simply displays the information inside of the console window.
My Blog | My Setup | My Videos | Have a wonderful day.


Possibly Related Threads…
Thread Author Replies Views Last Post
  PIN Program WitherSlayer 0 7,133 01-09-2013, 08:37 PM
Last Post: WitherSlayer

Forum Jump:


Users browsing this thread: 1 Guest(s)