Skip to content

Instantly share code, notes, and snippets.

@gAmUssA
Created September 26, 2012 02:15
Show Gist options
  • Save gAmUssA/3785610 to your computer and use it in GitHub Desktop.
Save gAmUssA/3785610 to your computer and use it in GitHub Desktop.
Read from file, Java 6 example
try{
FileReader fileReader = new FileReader("blah.txt");
BufferedReader reader = new BufferedReader(fileReader);
try{
String line = nul;;
while((line = reader.readLine())!=null){
System.out.println(line);
}
finally{
reader.close();
}
}
}catch(IOException ioe){
System.err.println("error: "+ ioe.getMessage)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment