+ 1
No such element? Please help!
I have the following: import java.util.Scanner; public class Program { public static void main(String[] args) { int a = 0; while (a != 3) { Scanner gs = new Scanner(System.in); System.out.println(gs.next()); gs.close(); a++; } } } It keeps throwing the noSuchElement error. What's going on? Is there a way I can get it to ask me for input multiple times? Help and explanation would be much appreciated.
1 Réponse
+ 10
No, you have to input all values at the playground at once, separated by line breaks.
See this post:
https://www.sololearn.com/discuss/217079/?ref=app