Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Login {
- public static void main(String[] args) {
- String username, usernameInput;
- int password, passwordInput;
- boolean login = false;
- Scanner input = new Scanner(System.in);
- Scanner enter = new Scanner(System.in);
- System.out.print("Please enter a desired username: ");
- username = input.nextLine();
- System.out.print("Please enter a desired password: ");
- password = enter.nextInt();
- System.out.println("Log in:");
- while (login == false) {
- System.out.print("Please enter your username: ");
- usernameInput = input.nextLine();
- System.out.print("Please enter your password: ");
- passwordInput = enter.nextInt();
- if (username.equals(usernameInput) && password == passwordInput) {
- System.out.println("You have successfully logged in!");
- login = true;
- }
- else {
- System.out.println("Login unsuccessful... try again");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement