Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PasswordGuess {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String pass = scanner.nextLine();
- if (pass.equals("s3cr3t!P@ssw0rd")) {
- System.out.println("Welcome");
- } else {
- System.out.println("Wrong password!");
- }
- }
- }
- ИЛИ:
- import java.util.Scanner;
- public class PasswordGuess {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String pass = scanner.nextLine();
- System.out.println(pass.equals("s3cr3t!P@ssw0rd") ? "Welcome": "Wrong password!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement