Advertisement
myrdok123

02. Password

Apr 6th, 2024
1,053
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. package WhileLoop;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P02Password {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         String username = scanner.nextLine();
  11.         String password = scanner.nextLine();
  12.         String input = scanner.nextLine();
  13.  
  14.         while (!input.equals(password)){
  15.  
  16.             input = scanner.nextLine();
  17.  
  18.         }
  19.  
  20.  
  21.         System.out.printf("Welcome %s!", username);
  22.  
  23.     }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement