Please, I need help debugging. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
30th Nov 2022, 10:25 PM
Emediong ā€œTakiā€ Inyangetuk
Emediong ā€œTakiā€ Inyangetuk - avatar
2 Respostas
+ 4
Emediong ā€œTakiā€ Inyangetuk No need of 2 scanner object 1 scanner object is enough to take values.
1st Dec 2022, 12:14 AM
AĶ¢J
AĶ¢J - avatar
+ 3
The error happens because you try to read from a empty stream (for get N2). Internally the Scanner class fill an internal buffer at any read (next call) then when you init f Scanner System.in is yet readed from sc Scanner then f will raise an exception because it cannot read from the in. You can solve by using one Scanner only or read from only one of them
30th Nov 2022, 11:19 PM
KrOW
KrOW - avatar