13th Jul 2017, 4:51 AM
esraa ragab
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 ^^
13th Jul 2017, 5:03 AM
Dev
Dev - avatar
+ 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
13th Jul 2017, 4:56 AM
Dev
Dev - avatar
0
but what happen to object name2 why it make the error?
13th Jul 2017, 4:59 AM
esraa ragab