+ 1
Is it really necessary to use "scan.close(); "? After usage of scanner in every program
2 Réponses
+ 4
If you do not close the scanner class it will generate warnings like Resource leak.
Resource leak happens when a program doesn't release the resources it has acquired. As OS have limit on the no of sockets,file handle,database conn etc thus its extremely important to manage these non-memory resources explicitly. So we explicitly call close() methods to free upresources
+ 1
Thanks mate