Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.io.IOException;
- public class fileReaderExample {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- BufferedReader br = null;
- try
- { //beginning of try
- String sCurrentLine = "";
- br = new BufferedReader (new FileReader("C:\\Users\\Oona\\My Documents\\dataFileExample.txt"));
- while((sCurrentLine = br.readLine()) != null)
- {
- System.out.println(sCurrentLine);
- }
- }// end of try
- catch (IOException e){}
- finally
- {
- try
- { //beginning of try
- if(br != null) br.close();
- } //end of try
- catch(IOException ex){}
- }
- } //class ends
- } //program ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement