Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

systemoutprintlnenter

file concept
Wednesday, 22 June 2011 08:13
// 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");
}
}

}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/RZoJiugVrzE/13285

 


Taxonomy by Zaragoza Online