Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. public static void createNewAccount() {
  2.  
  3. Scanner newScan = new Scanner(System.in);
  4. System.out.print("Enter name: ");
  5. String inputName = newScan.nextLine();
  6. name = inputName;
  7. System.out.print("Enter the initial value: ");
  8. double inputBalance = newScan.nextInt();
  9. System.out.println("... successfully created new account.");
  10.  
  11. keyScan.close();
  12.  
  13.  
  14. Account newAccount = new Account(inputName, inputBalance);
  15.  
  16. }
  17.  
  18. ...
  19. Scanner in = new Scanner(System.in);
  20.  
  21. Account.createAccount();
  22. //Debugging statement #1 here works fine, can access other Class
  23. do{
  24. /*
  25. Menu Options
  26. */
  27. System.out.println(">> Select your option (1-6)");
  28. choice = in.nextInt();
  29.  
  30. //Debugging statement #2 here doesn't display, this is where the error hits.
  31.  
  32. switch (choice) {
  33. ... Cases
  34. }
  35.  
  36. >> Select your option (1-6)
  37. Exception in thread "main" java.util.NoSuchElementException
  38. at java.util.Scanner.throwFor(Unknown Source)
  39. at java.util.Scanner.next(Unknown Source)
  40. at java.util.Scanner.nextInt(Unknown Source)
  41. at java.util.Scanner.nextInt(Unknown Source)
  42. at Management.main(Management.java:30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement