Do I need to close() both FileReader and BufferedReader?
no. BufferedReader.close() closes the stream according to javadoc for BufferedReader and InputStreamReader as well as FileReader.close() does.
no. BufferedReader.close() closes the stream according to javadoc for BufferedReader and InputStreamReader as well as FileReader.close() does.
In currently latest JDK6 release/build (b27), the Scanner has a smaller buffer (1024 chars) as opposed to the BufferedReader (8192 chars), but it’s more than sufficient. As to the choice, use the Scanner if you want to parse the file, use the BufferedReader if you want to read the file line by line. Also see … Read more