Sim0o0na

Untitled

Jan 18th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4. * Created by todor on 18.01.2017 г..
  5. *
  6. * Да се напише програма, която въвежда парола (един ред с произволен текст) и проверява дали въведеното съвпада
  7. * с фразата “s3cr3t!P@ssw0rd”. При съвпадение да се изведе “Welcome”. При несъвпадение да се изведе “Wrong password!”.
  8. */
  9. public class u09_PasswordGuess {
  10. public static void main(String[] args) {
  11.  
  12. Scanner scan = new Scanner(System.in);
  13.  
  14. String myPassword = "s3cr3t!P@ssw0rd";
  15. String userPassword = scan.nextLine();
  16.  
  17. if (myPassword.equals(userPassword)){
  18. System.out.println("Welcome");
  19. }
  20. else {
  21. System.out.println("Wrong password!");
  22. }
  23.  
  24. }
  25. }
Add Comment
Please, Sign In to add comment