deyanivanov966

02. Password

Apr 1st, 2021 (edited)
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Password {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         //регистрация
  8.         String userName = scanner.nextLine();
  9.         String password = scanner.nextLine();
  10.         String currentTry = scanner.nextLine();
  11.  
  12.         //въвеждаме паролата докато != на password
  13.         while (!currentTry.equals(password)){
  14.             currentTry = scanner.nextLine();
  15.         }
  16.         System.out.printf("Welcome %s!", userName);
  17.     }
  18. }
  19.  
Add Comment
Please, Sign In to add comment