Java FileReader(File file) Constructor
Syntax
FileReader(File file) constructor from FileReader has the following syntax.
public FileReader(File file) throws FileNotFoundException
Example
In the following code shows how to use FileReader.FileReader(File file) constructor.
/*from w w w.j a v a 2 s .c om*/
import java.io.File;
import java.io.FileReader;
public class Main {
public static void main(String[] args) throws Exception {
FileReader fileReader = new FileReader(new File("c:/abc.txt"));
System.out.println(fileReader.read());
fileReader.close();
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »