While coding a random Employee storer, I use Scanner, and its .nextInt(); to ask the user for the employee's contact number:
Scanner Scan = new Scanner(System.in); out.print("\nEnter Employee Contact Number:"); newEmployee.contactNumber = Scan.nextInt(); //(I have a class Employee)
I get the error :
Enter Employee Contact Number:456645 Exception in thread "main" java.util.InputMismatchException 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 employeestore.EmployeeStorer.addEmployee(EmployeeStorer.java:55) at employeestore.EmployeeStorer.main(EmployeeStorer.java:25)
I have done about half an hour of google-ing and I am currently *extremely* annoyed. Any help would be helpful. Thanks.
Edited 5 Years Ago by Dannyo329: n/a