import java.io.File;
import java.io.InputStreamReader;
import java.io.BufferedReader;
public class Rec{
public void txtMod(){
File fileName = new File ("C:\\work\\imput.txt");
BufferedReader in = new BufferedReader (new InputStreamReader(fileName));
...
}
}
new InputStreamReader(fileName) gets underlined with the following error: ‘The constructor InputStreamReader(File) is undefined‘. How do I define it? Doesn’t new define it?
That isn’t a valid argument for constructing an InputStreamReader. You need to create the InputStream and pass that to the InputStreamReader.
However, the best way to do this is to use a FileReader.