desislava_topuzakova

05. Password Guess

Jun 12th, 2021
834
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class PasswordGuess {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         //1. прочитаме парола (текст)
  7.         String password = scanner.nextLine();
  8.  
  9.         //2. проверка дали паролата е "s3cr3t!P@ssw0rd"
  10.             // ако паролата е "s3cr3t!P@ssw0rd" -> Welcome
  11.             // ако пароалта не е "s3cr3t!P@ssw0rd" -> Wrong password!
  12.  
  13.         if (password.equals("s3cr3t!P@ssw0rd")) {
  14.             System.out.println("Welcome");
  15.         } else {
  16.             //различни
  17.             System.out.println("Wrong password!");
  18.         }
  19.     }
  20. }
  21.  
RAW Paste Data