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

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?

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

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