Advertisement
veronikaaa86

02. Password

Mar 26th, 2022
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. package whileLoops;
  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 currentPass = scanner.nextLine();
  13. while (!currentPass.equals(regPass)) {
  14. currentPass = scanner.nextLine();
  15. }
  16.  
  17. System.out.println("Welcome " + username + "!");
  18.  
  19.  
  20. }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement