30th Nov 2022, 10:25 PM
Emediong “Taki” Inyangetuk
Emediong “Taki” Inyangetuk - avatar
2 Réponses
+ 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