Scanner class doubt

It shows a warning when I import scanner class

add scn.close(); at end
Closing your Scanner means you cut the connection to the keyboard or in other words: your program is not waiting for user input anymore.
https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html

Most of the IDE’s closes the Scanner if you don’t use the close method. But I’m not sure what will happen if you have not closed the scanner in an executable Java program.
Hope this helps :slight_smile: