title: can we open multiple FileWriter stream to the same file at the same time?
body: <p>Can we open multiple FileWriter stream to the same file at the same time. I wrote some codes to test this, and apparently it allow to be happened. This stumble me. Since if I open a File Writer to file, and before close it, I try to delete the file, well I cant. So how and why can I open multiples FileWriter stream to the same file at one time? Here is what I try</p>
  
  <pre><code>private static final int SIZE = 1000;
  
  public static void main(String[] args) throws IOException, InterruptedException {
      File file = new File("C:\\dev\\harry\\data.txt");
      FileWriter fileWriter = new FileWriter(file, true);
      BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
      for (int i = 0; i &lt; SIZE; i++) {
          bufferedWriter.write("1\n");
          Thread.sleep(100);
      }
  
      if (bufferedWriter != null) bufferedWriter.close();
      if (fileWriter != null) fileWriter.close();
  }
  </code></pre>
  
  <p>I have another process, that does the exact same thing, but instead write <code>2</code> out, and I get both <code>1</code> and <code>2</code>, in my data file.</p>