wiley_pastebin icon

closingstreams 3

wiley_pastebin | PRO | 03/15/19 03:16:07 PM UTC | 0 ⭐ | 2507 👁️ | Never ⏰ | []
Java |

490 B

|

None

|

0 👍

/

0 👎

public void processFile(String filename){ 
 try { 
  String line;
  BufferedReader br = null; 
  try { 
   br = new BufferedReader(new FileReader(filename)); 
   line = br.readLine(); 
  } catch (FileNotFoundException e) { 
   // deal with file not found exception 
  } catch (IOException e) { 
   // deal with other io exceptions 
  } finally { 
   if(br != null) { 
   br.close(); 
  } 
 } 
} catch (IOException e){ 
  // if close throws an exception – very unlikely 
 } 
}

Comments