+ 1
How to use Scanner
When i import java.util.scanner The want to get the input from the user, its always saying the local variable is never closed. I did it this way Scanner x = new Scanner(System.in); System.out.print(x.nextLine());
4 Respuestas
+ 6
Apparently some versions of Java will warn you if your scanner is left unclosed. To fix this, just close your scanner once you no longer have any need for it.
Scanner x = new Scanner(System.in);
System.out.print(x.nextLine());
x.close();
https://www.tutorialspoint.com/java/util/scanner_close.htm
+ 2
Didn't know that, thanks Hatsy Rei
+ 1
Thanks hatsy Rei. It works
0
Oh that is useful thx!