Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Login {
  3.  
  4.     public static void main(String[]args) {
  5.  
  6.         String username = "BruceLee";
  7.         String password1 = "ilovemum9";
  8.         String usernameInput;
  9.         String password1Input;
  10.  
  11.         Scanner input = new Scanner(System.in);
  12.  
  13.         System.out.println("Please enter your username to Login");
  14.  
  15.         usernameInput = input.nextLine();
  16.  
  17.         System.out.println("Please enter your password");
  18.         password1Input = input.nextLine();
  19.  
  20.  
  21.         loginLogic(username, password1, usernameInput, password1Input );
  22.  
  23.  
  24.     }
  25.  
  26.     public static void loginLogic(String username, String password1, String usernameInput,String password1Input ){
  27.  
  28.         if(username.equals(usernameInput) && password1.equals(password1Input)) {
  29.  
  30.                     System.out.println("Welcome "+username+" You are logged in");
  31.                 }
  32.                 else {
  33.  
  34.                     System.out.println("Wrong credentials, try again");
  35.  
  36.         }
  37.  
  38.     }
  39.  
  40.  
  41.  
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement