-
-
Save uncoded-ro/ca0100f2aff513d9be8f265663063b0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ro.virtualcampus.read; | |
import java.io.*; | |
public class ReadFromFile { | |
public static void main(String args[]) { | |
BufferedReader fin = null; | |
try { | |
fin = new BufferedReader(new FileReader("in.txt")); | |
String buffer; | |
while ((buffer = fin.readLine()) != null) { | |
System.out.println(buffer); | |
} | |
} catch (FileNotFoundException e) { | |
e.printStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} finally { | |
try { | |
if (fin != null) | |
fin.close(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment