Password Program - Printable Version +- BP Forums (https://bpforums.info) +-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55) +--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56) +---- Forum: Java (https://bpforums.info/forumdisplay.php?fid=19) +---- Thread: Password Program (/showthread.php?tid=728) |
Password Program - WitherSlayer - 01-09-2013 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 Re: Password Program - andrei.xd23 - 05-07-2013 what's the difference between joptionpane and system.out.println? Re: Password Program - brandonio21 - 05-07-2013 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. |