Would there ever be a case where an exception could be thrown by assigning the value of input.nextLine()
to a String
variable with the Scanner
?
Like if you put
String foo = input.nextInt();
You would get an InputMismatchException
. So what I'm wondering is if there's any possible way to get an exception from:
String foo = input.nextLine();
It might be a dumb question but I need to be absolutely sure.
Thanks in advance!
The answer in the docs:
Tip for easier and safer life: Always refer to the docs.