I had a line of code
Scanner input = new Scanner (System.in);
and I use input to get some user input.
My program warns me that there is a resource leak because input is never closed.
Once I add the line
input.close();
it stops complaining and everything works fine.
I am new to Java and was wondering what is the purpose of closing input? what does it do.