veronikaaa86

05. Password Guess

May 15th, 2021
808
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ConditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P05PasswordGuess {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         String input = scanner.nextLine();
  10.  
  11.         //s3cr3t!P@ssw0rd
  12.  
  13.         boolean isValid = input.equals("s3cr3t!P@ssw0rd");
  14.  
  15.         if (isValid) {
  16.             System.out.println("Welcome");
  17.         } else {
  18.             System.out.println("Wrong password!");
  19.         }
  20.     }
  21. }
  22.  
RAW Paste Data