+ 1
what is the error?
3 Réponses
+ 11
@alisa :
Using multiple scanners on the same stream is the underlying problem. Scanners can (and will) consume the stream - this may (will) lead to unexpected side-effects. Best not to do it.
If the input is closed, then the input (but Strings have no close method) is closed for everyone - and that's not much fun for anyone.
P.S. Try to avoid it ^^
+ 10
Please don't make two objects of one Scanner class. It would cause an error. Instead, try to get two inputs with only one object. Now the code works perfect :
https://code.sololearn.com/cOJd33B6TC3D/?ref=app
0
but what happen to object name2 why it make the error?