Every time we write code with FileInputStream,
BufferReader
etc. we need to close those resource explicitly in finally block.Now from Java 7, there are two interfaces included
Closeable
andAutoCloseable
with single abstract methodclose(),
which enables implementing class to close resources aromatically after try block.Lets see how …
This post first appeared on The Geeky Way | Technology Inside Out, please read the originial post: here