Why am I getting an error as exception in main thread what's wrong in my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why am I getting an error as exception in main thread what's wrong in my code?

https://code.sololearn.com/c8sq7v6YIUeQ/?ref=app

6th Nov 2020, 2:45 PM
Apurva Deshpande
Apurva Deshpande - avatar
5 Answers
+ 2
It is may be because you are creating multiple instances of the Scanner class. Put the Scanner instantiation outside the do while and it should work fine.
6th Nov 2020, 2:54 PM
Avinesh
Avinesh - avatar
+ 1
I solved it
6th Nov 2020, 3:54 PM
Apurva Deshpande
Apurva Deshpande - avatar
0
It's a quiz given in do while loop lesson of solo learn.. it says u need to put scanner class inside the loop to take multiple inputs
6th Nov 2020, 3:30 PM
Apurva Deshpande
Apurva Deshpande - avatar
0
I have given the problem inside the code
6th Nov 2020, 3:30 PM
Apurva Deshpande
Apurva Deshpande - avatar
0
I m not understanding
6th Nov 2020, 3:39 PM
Apurva Deshpande
Apurva Deshpande - avatar