import java.io.*;
class ReadFile{
public static void main(String args[]) {
try {
FileInputStream fstream = new FileInputStream("c:/yash.txt");
DataInputStream disobj = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(disobj));
String frst = br.readLine();
String scnd = br.readLine();
if (frst != null) {
System.out.println(frst);
System.out.println(scnd);
}
else{
System.out.println("empty");
}
disobj.close();
}
catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
}
No comments:
Post a Comment