Reply to comment
Opening / Displaying Content of Text File in java
Tagged:
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class OpenFile {
public static void main(String[] args)
throws IOException {
String path = "/home/jr/Desktop/file1.txt";
File file = new File(path);
DataInputStream dis = new
DataInputStream(new BufferedInputStream(
new FileInputStream(file) ) );
if( file.exists() )
while (dis.available() != 0)
System.out.println(dis.readLine());
else
System.out.println(" file does not exist");
dis.close();
}
}

Recent comments
5 days 3 hours ago
2 weeks 4 days ago
3 weeks 1 hour ago
3 weeks 1 hour ago
4 weeks 2 days ago
4 weeks 5 days ago
4 weeks 5 days ago
6 weeks 1 day ago
7 weeks 3 days ago
7 weeks 3 days ago