1
How do you stop scanner from overloading? (Java)
Murzikal (21)

In my Code, if you enter a large number like 10000000000000000000, it gives an error and ends the program.
Is there any way to fix this?
Error:

Exception in thread "main" java.util.InputMismatchException: For input string: "10000000000000000000"
    at java.util.Scanner.nextInt(Scanner.java:2123)
    at java.util.Scanner.nextInt(Scanner.java:2076)
    at Main.main(Main.java:17)
exit status 1
You are viewing a single comment. View All
Answered by malvoliothegood (90) [earned 5 cycles]
View Answer
1
Murzikal (21)

@malvoliothegood Yeah, thanks. I forgot about the 32 bit max, 2,147,483,647.