title: Should I close the BufferedWriter?
body: <p>In class A, my program receives the command line by line, then creates an instance of class B according to the instruction, in the program executing each instruction in instance B,
  To execute the command for the output, the following method carried out. 
  <code>bw</code> was declared a member of class B.</p>
  
  <pre><code>@Override
   public void command (DB db) throws Exception {
    ...
    bw = new BufferedWriter(new OutputStreamWriter(System.out));
    for (Item item : db) {
     bw.write("("+item.getTitle()+")");
     bw.newLine();
    }
    bw.flush();
   }
  </code></pre>
  
  <p>In fact, this did not cause any problems,
  Because I thought the program should close the <code>BufferedWriter</code>, I closed it in the above method, 
  the next time the method called again, There was a problem that the output no longer occurs, even though the <code>BufferedWriter</code> was not a kind of static variable.
  In this situation, can I not close it ??</p>
  
  <p>"make <code>BufferedWriter</code> static and close the <code>BufferedWriter</code> when the program exit" can be the solution?? </p>