I have small doubt, this could be very lame question but please bear with me.
I was checking the source code of FileReader. So when ever a FilerReader created it constructs FileInputStream. Here is the code snippet
public class FileReader extends InputStreamReader {
public FileReader(String fileName) throws FileNotFoundException {
super(new FileInputStream(fileName));
}
My Doubt here is FileReader extends InputStreamReader, here FileReader is a child of InputStreamReader, but when constructor of FileReader is called, then how come this is possible "super(new FileInputStream(fileName));"
?
There is no constructor or method which accepts new FileInputStream(fileName)
as parameter in parent class which is InputStreamReader.
Fileinput stream has following hierarchy ..
java.lang.Object
java.io.InputStream
java.io.FileInputStream
Doesnt seems to be any relation between FileInputStream and InputStreamReader..!
Can anyone help me to understand this ? How and from where super(new FileInputStream(fileName));
is being called here ?