package readfile; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author nurhak.kaya */ public class ReadFile { public static void main(String[] args) { File file = new File("text.txt"); StringBuffer sb = new StringBuffer(); BufferedReader br = null; String text = null; try { br = new BufferedReader(new FileReader(file)); while ((text = br.readLine()) != null) { sb.append(text).append( System.getProperty("line.separator")); System.out.println(text); } } catch (Exception e) { } finally { if (br != null) { try { br.close(); } catch (IOException ex) { Logger.getLogger
Solution Architect | Umbraco Certified Master | Umbraco MVPx3 | Certified ScrumMaster
"Anyone can cook, but only the fearless can be great." Ratatouille