Advertisement
Guest User

Untitled

a guest
Jul 24th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Usernames {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner reader = new Scanner(System.in);
  7.        
  8.         System.out.print("Type your username: ");
  9.        
  10.         String username = reader.nextLine();
  11.                
  12.         System.out.print("Type your password: ");
  13.         String password = reader.nextLine();
  14.                
  15.         if (username.equals("alex") && password.equals("mightyducks"){
  16.                     System.out.print("You are now logged into the system!");
  17.         } else if (username.equals("emily") && password.equals("cat")) {
  18.                     System.out.print("You are now logged into the system!");
  19.         } else {
  20.                     System.out.println("Your username or password was invalid!");
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement