meeta gaur wrote:I couldn't figure out meaning of NOTE: the close() methods of resources are called in the OPPOSITE order of their creation.
Basically, what it means is that
close() methods 'drill up' hierarchy-wise, because Closeables (at least the ones in the
Java foundation classes) tend to extend or wrap each other.
The example shows a BufferedReader, which requires a ready-made Reader - in your case a FileReader - which in turn extends InputStreamReader which wraps an InputStream.
All the note is telling you is that
close() on BufferedReader invokes
close() on its FileReader, which in turn calls
super.close() (InputStreamReader) which calls the
close() method for its InputStream - hence, reverse order of creation.
Winston