Why its asking to enter digit only once? | Sololearn: Learn to code for FREE!

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

4/23/2020 9:00:13 AM

🌠Ankur🌠

5 Answers

New Answer

+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.

+4

Sololearn doesn't allow creating 2 or more instance of Scanner object

+1

Avinesh still same but got it ,it doesn't allow 2 or more scanner obj, and yes I got your point 🙂✌️

0

That's sad , anyway thanks ✌️🙂

0

Yes I got the difference ,thanks