wiley_pastebin

closingstreams 2

Mar 15th, 2019
2,523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. public void processFile(String filename){
  2.  String line;
  3.  BufferedReader br = null;
  4.  try {
  5.   br = new BufferedReader(new FileReader(filename));
  6.   line = br.readLine();
  7.  } catch (FileNotFoundException e) {
  8.   // deal with file not found exception
  9.  } catch (IOException e) {
  10.   // deal with other io exceptions
  11.  } finally {
  12.  if(br != null) {
  13.   br.close();
  14.  } 
  15.  // ...
  16. }
Add Comment
Please, Sign In to add comment