+ 7
Just like memory, the file is a resource that your program is using. when you don't need it anymore you close the connection. Also at writing in a file, if you have data in a buffer and you don't use the close method then you could pottentialy lose data. Here is a similar question to yours that i found in the forum. Please use the search bar in the future to check if your question was asked before. https://www.sololearn.com/Discuss/2236399/is-it-really-necessary-to-use-scan-close-after-usage-of-scanner-in-every-program
30th Apr 2020, 8:08 AM
notqueued
notqueued - avatar