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,
filewriter.close();
bufferwriter.close();
This order to me feels correct. The other way however,
bufferedwriter.close();
filewriter.close();
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 ?