0

Why its asking to enter digit only once?

I put two scanner ,but here when I run code it shows once only once and shows some exception error. https://code.sololearn.com/cVXX8DGK2Qy9/?ref=app

23rd Apr 2020, 9:00 AM
šŸŒ AnkuršŸŒ 
šŸŒ AnkuršŸŒ  - avatar
4 Answers
+ 1
Remove line 12 Change line 15 to - num2 =digit.nextInt(); Also šŸŒ AnkuršŸŒ  do not create more than one instance of scanner class, it can be avoided almost 90% of time. Just a single instance is more than enough for pretty much all the basic programs we write. Edit: It is allowed or not is secondry, I'm saying it's unnecessary. Hope you get the difference.
23rd Apr 2020, 9:06 AM
Avinesh
Avinesh - avatar
+ 1
Avinesh still same but got it ,it doesn't allow 2 or more scanner obj, and yes I got your point šŸ™‚āœŒļø
23rd Apr 2020, 9:11 AM
šŸŒ AnkuršŸŒ 
šŸŒ AnkuršŸŒ  - avatar
0
That's sad , anyway thanks āœŒļøšŸ™‚
23rd Apr 2020, 9:07 AM
šŸŒ AnkuršŸŒ 
šŸŒ AnkuršŸŒ  - avatar
0
Yes I got the difference ,thanks
23rd Apr 2020, 9:16 AM
šŸŒ AnkuršŸŒ 
šŸŒ AnkuršŸŒ  - avatar