Advertisement
veronikaaa86

02. Password

Jul 30th, 2022
1,518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 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 pass = scanner.nextLine();
  11.  
  12.         String inputData = scanner.nextLine();
  13.         while (!inputData.equals(pass)) {
  14.  
  15.             inputData = scanner.nextLine();
  16.         }
  17.  
  18.         System.out.printf("Welcome %s!", username);
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement