Yes. All this object creation (and the garbage collector running in the background) takes processor time, but for most programs this is not noticeable.
The constructor for BufferedReader
looks
like this:
BufferedReader( Reader in )
The constructor for FileReader
looks
like this:
FileReader( String fileName ) throws FileNotFoundException
The methods from BufferedReader
which
interest us are:
void close() throws IOException // close the stream int read() throws IOException // read a single character into an int String readLine() throws IOException // read one line of characters into a String.
The read()
method will be discussed later.
(Both classes have other constructors and other methods
which will not be discussed here).
What does the close()
method do with an input stream?