Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner; //this imports the java scanner we need
- class login {
- public static void main(String args[]){ //sorry this is too long to explain
- Scanner luci = new Scanner(System.in); //this makes the scanner usable
- String idInput; //creates a string called idInput
- System.out.println("Please type Username: "); //tells us to type the username
- idInput = luci.nextLine(); //this stores whatever we type in the string
- String passwordInput; // creates the password string
- System.out.print("Please type Password: "); //tells us to input password
- passwordInput = luci.nextLine(); //set whatever we inputed to the string passwordInput
- if(passwordInput.equals("password") && (idInput.equals("alex"))){ //this checks what
- //is stored in passwordInput and idInput and if pass is = to : password and id is = to: alex
- //then type
- System.out.println("Login complete!"); //this here <--
- }else{ //if the password or username are wrong or both wrong type the correct ones
- System.out.println("Wrong Username or Password!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement