I'm trying to pass a string into the method and have it return the results from mydata2. It keep getting the error "missing return statement".
Code:
// Main method
public static String readData (String arg1)
{
// Stream to read file
FileInputStream fin;
try
{
// Open an input stream
String mydata2="";
fin = new FileInputStream (arg1);
// Read a line of text
mydata2 = new DataInputStream(fin).readLine();
// Close our input stream
fin.close();
return mydata2;
}
// Catches any error conditions
catch (IOException e)
{
//System.err.println ("Unable to read from file");
System.exit(-1);
}
}
Bookmarks