Home Segments Top Top Previous Next

475: Mainline

When you are finished with an file input stream, you should close it, using the close method:

stream.close() 

Java generally closes all streams for you, once they no longer can be accessed, but Java may not close a particular stream for a long time. Accordingly, you should close files, using the close method, as a matter of good programming practice.