I use the following style to read a file with BufferedReader
try (BufferedReader br = new BufferedReader(new FileReader("my_file"))) {
...
br.close();
} catch( IOException e ) {
System.out.println( e.getMessage() );
}
Things that I want to know:
1- Is close() in the right place?
2- Should I put another try..catch for `close()?
3- Since I used new for br, is the enough to call the close() or I have to write br = null for the GC?
4- FileReader has been newed, so should I destroy it?