Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Logiranje {
- public static void main(String[] args){
- //Declaring
- Scanner skener = new Scanner(System.in);
- String username;
- String password;
- String checkUsername;
- String checkPassword;
- //Welcome text
- System.out.println("Welcome user, please register before continuing!");
- System.out.println("Type in your desired username and password");
- //Register
- System.out.println("Type in the desired username");
- username = skener.nextLine();
- System.out.println("After you typed in your username, type in the desired password");
- password = skener.nextLine();
- //Login
- System.out.println("You may now proceed to login!");
- System.out.println("Type in your username");
- checkUsername = skener.nextLine();
- System.out.println("Type in your password");
- checkPassword = skener.nextLine();
- if (username == checkUsername && password == checkPassword){
- System.out.println("You have sucessfully logged in!");
- } else {
- System.out.println("You have typed in the wrong credentials, please try again!");
- System.out.println("Type in your username");
- checkUsername = skener.nextLine();
- System.out.println("Type in your password");
- checkPassword = skener.nextLine();
- if (username == checkUsername && password == checkPassword){
- System.out.println("You have sucessfully logged in!");
- } else {
- System.out.println("You have failed to login too many times, please exit");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement