I am trying to read a simple file and then a file which the user is supposed to select. I keep on getting the following error though:
Readzilla.java:3
BufferedReader
class doesn't have a method called FileReader
.
You can see it in the documentation.
One way of reading a file in Java 1.4.2 is:
try
{
String line;
File file = new File(file);
BufferedReader inFile = new BufferedReader(new FileReader(file));
while((line = inFile.readLine()) != null)
{
System.out.println(line)
}
inFile.close();
}
catch (IOException e)
{
System.out.println("problem with file");
}