title: What order should I follow to close the bufferedwriter and filewriter?
body: <p>I know that BufferedWriter.close would automatically close the underlying filewriter source. But for some reason I have been given the task which requires closing both. So far I have been doing it in this order,</p>
  
  <p>filewriter.close();</p>
  
  <p>bufferwriter.close();</p>
  
  <p>This order to me feels correct. The other way however,</p>
  
  <p>bufferedwriter.close();</p>
  
  <p>filewriter.close();</p>
  
  <p>here, wont it throw a null pointer since the filewriter would already be closed? What is the correct order ? Also does the same apply to bufferedreader and filereader ?</p>