+ 1

Is it really necessary to use "scan.close(); "? After usage of scanner in every program

11th Apr 2020, 1:24 AM
Shankar Devaraju
Shankar Devaraju - avatar
2 Antworten
+ 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
11th Apr 2020, 3:15 AM
Arsenic
Arsenic - avatar
+ 1
Thanks mate
11th Apr 2020, 4:05 AM
Shankar Devaraju
Shankar Devaraju - avatar