Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Logiranje {
  3. public static void main(String[] args){
  4.  
  5. //Declaring
  6. Scanner skener = new Scanner(System.in);
  7. String username;
  8. String password;
  9. String checkUsername;
  10. String checkPassword;
  11.  
  12.  
  13. //Welcome text
  14. System.out.println("Welcome user, please register before continuing!");
  15. System.out.println("Type in your desired username and password");
  16.  
  17. //Register
  18. System.out.println("Type in the desired username");
  19. username = skener.nextLine();
  20.  
  21. System.out.println("After you typed in your username, type in the desired password");
  22. password = skener.nextLine();
  23.  
  24. //Login
  25. System.out.println("You may now proceed to login!");
  26. System.out.println("Type in your username");
  27. checkUsername = skener.nextLine();
  28. System.out.println("Type in your password");
  29. checkPassword = skener.nextLine();
  30.  
  31. if (username == checkUsername && password == checkPassword){
  32. System.out.println("You have sucessfully logged in!");
  33. } else {
  34. System.out.println("You have typed in the wrong credentials, please try again!");
  35. System.out.println("Type in your username");
  36. checkUsername = skener.nextLine();
  37. System.out.println("Type in your password");
  38. checkPassword = skener.nextLine();
  39.  
  40. if (username == checkUsername && password == checkPassword){
  41. System.out.println("You have sucessfully logged in!");
  42. } else {
  43. System.out.println("You have failed to login too many times, please exit");
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement