Java FileReader(String fileName) Constructor

Syntax

FileReader(String fileName) constructor from FileReader has the following syntax.

public FileReader(String fileName)   throws FileNotFoundException

Example

In the following code shows how to use FileReader.FileReader(String fileName) constructor.


//w  w  w  . j av a  2s  . c o m
import java.io.FileReader;

public class Main {
  public static void main(String[] args) throws Exception {
    FileReader fileReader = new FileReader("c:/abc.txt");
    System.out.println(fileReader.read());
    fileReader.close();
    
  }
}