Untitled


SUBMITTED BY: antoineh1

DATE: June 3, 2016, 12:53 p.m.

FORMAT: Text only

SIZE: 743 Bytes

HITS: 571

  1. public static void main(String[] args) {
  2. Scanner user_input= new Scanner(System.in);
  3. String userName = "cakesterman";
  4. String passWord = "Test";
  5. String input;
  6. System.out.println("Correct username is: " + userName);
  7. System.out.println("Enter Your Username: ");
  8. input = user_input.next();
  9. System.out.println("You entered: " + input);
  10. if (input == userName) {
  11. System.out.println("Username is correct");
  12. }
  13. else {
  14. while (input != userName) {
  15. System.out.println("Username Incorrect. Enter Your Username: ");
  16. input = user_input.next();
  17. if (input == userName) {
  18. break;
  19. }
  20. }
  21. }
  22. }

comments powered by Disqus