Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void createNewAccount() {
- Scanner newScan = new Scanner(System.in);
- System.out.print("Enter name: ");
- String inputName = newScan.nextLine();
- name = inputName;
- System.out.print("Enter the initial value: ");
- double inputBalance = newScan.nextInt();
- System.out.println("... successfully created new account.");
- keyScan.close();
- Account newAccount = new Account(inputName, inputBalance);
- }
- ...
- Scanner in = new Scanner(System.in);
- Account.createAccount();
- //Debugging statement #1 here works fine, can access other Class
- do{
- /*
- Menu Options
- */
- System.out.println(">> Select your option (1-6)");
- choice = in.nextInt();
- //Debugging statement #2 here doesn't display, this is where the error hits.
- switch (choice) {
- ... Cases
- }
- >> Select your option (1-6)
- Exception in thread "main" java.util.NoSuchElementException
- at java.util.Scanner.throwFor(Unknown Source)
- at java.util.Scanner.next(Unknown Source)
- at java.util.Scanner.nextInt(Unknown Source)
- at java.util.Scanner.nextInt(Unknown Source)
- at Management.main(Management.java:30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement