Hi, I've been starting to go through my programs by doing one part at a time so i don't run into as many errors.
Can someone please look over my open/read method?
I'm getting 1 error when i attempt to compile it I've marked in code where it is
It says this when i try to compile
Prog3test.java:28: openread(java.io.File) in Prog3test cannot be applied to (java.lang.String)
String in = openread("input.txt");
import java.io.*;
import B102.*;
class Prog3
{
public String openread(File inputfile)
{
System.out.println("Opening File: " + inputfile.getName());
BufferedReader input = null;
String line;
try {
input = new BufferedReader(new FileReader(inputfile));
while((line = input.readLine())!= null)
{
break;
}
} catch(IOException in) {
System.out.println("There has been an error.");
} finally { // closing file, even on exception
try { input.close(); }
catch (Exception e) {}
}
return(line);
}
public static void main(String[] args)
{
String in = openread("input.txt"); *******error here*******
}
}
Thanks.