More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. Optimizing Resource utilization. When you open a file using any programming language , that is actually a request to operating system to access the file. When such a request is made , resources are allocated by the OS. When you gracefully close those files, those resources are set free.
In Java if you don’t close the streams and files, Garbage collection identifies the open files which have lost the reference and hence will close them.
Help us improve. Please let us know the company, where you were asked this question :