forked from PeopleNTechJavaSelenium/CoreJavaDay7
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadFile.java
More file actions
26 lines (24 loc) · 762 Bytes
/
Copy pathReadFile.java
File metadata and controls
26 lines (24 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package fileoperation;
import java.io.BufferedReader;
import java.io.FileReader;
public class ReadFile {
public static void main(String[] args) {
FileReader fr = null;
BufferedReader br = null;
String path = "/Users/peoplentech/develop/SeleniumJuly2018/class-notes/space.txt";
try{
fr = new FileReader(path);
}catch(Exception ex){
System.out.print("File is not found, plz check the path");
}
try{
br = new BufferedReader(fr);
String data="";
while((data = br.readLine()) != null){
System.out.println(data);
}
}catch(Exception ex){
System.out.print("File is not readable");
}
}
}