How To Read File In Java – BufferedReader

JDK 7, read file in Java and automatically close the file.

1:        BufferedReader br = new BufferedReader(new FileReader(file_path));  
2:        String text="";  
3:        String currentLine;  
4:        while ((currentLine = br.readLine())!=null){  
5:          text = text+currentLine;  
6:        }  

No comments:

Post a Comment