Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Password_02 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String username = scanner.nextLine();
- String password = scanner.nextLine();
- //повтаряме: въвеждаме парола
- //стоп: въведената парола == password
- //продължаваме: въведената парола != password
- String enteredPassword = scanner.nextLine(); //въведената парола
- while (!enteredPassword.equals(password)) {
- enteredPassword = scanner.nextLine();
- }
- //въведената парола == password
- System.out.println("Welcome " + username + "!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement