Advertisement
veronikaaa86

02. Password

Feb 4th, 2023
1,458
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.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         String username = scanner.nextLine();
  10.         String regPass = scanner.nextLine();
  11.  
  12.         String loginPass = scanner.nextLine();
  13.         while (!loginPass.equals(regPass)) {
  14.             loginPass = scanner.nextLine();
  15.         }
  16.  
  17.         System.out.printf("Welcome %s!%n", username);
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement