title: Regarding java file closing
body: <p>i noticed in a java program   the below line used  to open a file and process it</p>
  
  <pre><code>BufferedReader inp = new BufferedReader(new FileReader(inputFile));
  </code></pre>
  
  <p>In the javaprogram the inp is not closed before exiting the program the below line is missing</p>
  
  <pre><code>if (inp != null)
      try {
         inp.close();
      } catch (IOException logOrIgnore) {}
  </code></pre>
  
  <p>The program has exits in a lot of place but they had not closed the file. Do i need to put this line everywhere? If i dont close the file when the program exits  will it be a issue. 
  Does the garbage collector closes the file?</p>