title: deleteOnExit not deleting file
body: <p>I have created a few files for temporary use and used them as inputs for some methods. And I called</p>
  
  <pre><code>deleteOnExit() 
  </code></pre>
  
  <p>on all files I created. But one file still remains. </p>
  
  <p>I assume it is because the file is still in use, but doesn't the compiler go to next line only after the current line is done?(Single thread) </p>
  
  <p>While its not a problem practically because of java overwrite, there is only one file always. I would like to understand why it happens and also if I can use </p>
  
  <pre><code> Thread.sleep(sometime);
  </code></pre>
  
  <p>Edit:- </p>
  
  <pre><code>File x = new file("x.txt");
  new class1().method1();
  </code></pre>
  
  <p>After creating all files(5), I just added this line</p>
  
  <pre><code>x.deleteOnExit(); y.deletOnExit() and so on...
  </code></pre>
  
  <p>All the files except that last one is deleted.</p>