I this post I have given an code that demonstrates how to read a character file using FileReader and
try-with-resources in Java. Just like the post title says its not a tutorial but rather an example demonstration.
Try-With-Resources is a great feature
introduced in Java 7 where you don't need top worry about explicitly
closing the streams. It cares of them, It does so by implementing the AutoClosable iterface.
Please Note that this is not the better way to read a file. There are several other ways using the NIO and NIO2 packages which should be preferred for larger file sizes. All of them will be covered with time.
Please Note that this is not the better way to read a file. There are several other ways using the NIO and NIO2 packages which should be preferred for larger file sizes. All of them will be covered with time.
Share this post among your social networks.
Thank you.
0 comments :
Post a Comment