DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
File Concept
// description of your code here
import java.io.*;
public class Main {
public static void main(String[] args)throws IOException
{
String path,fname;
String dname;
System.out.println("Enter the File name you want to be Read");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
fname = br.readLine();
System.out.println("Enter the path");
dname=br.readLine();
path = dname+"/"+ fname;
FileReader fr = new FileReader(path);
String read;
try {
FileInputStream fStream = new FileInputStream(path);
BufferedReader in = new BufferedReader(new InputStreamReader(fStream));
while ((read=in.readLine())!=null) {
System.out.println(read);
}
in.close();
} catch (IOException e) {
System.out.println("File input error");
}
}
}





