This is an assignment for school. I'm in my second semester of object oriented programming. Here is the method causing the error when compiled in the test case:
public void testRead()
{
Company aCompany = buildCompany();
aCompany.writeToFile("CompanyDatabase.txt");
Company bCompany = new BooksAndMore();
bCompany = readFromFile("CompanyDatabase.txt");
assertTrue(aCompany.equals(bCompany));
}
Error thrown is "cannot find symbol - method readFromFile(java.lang.String). Here is the method being called:
{code} public static Company readFromFile(String fileName)
{
Company company = new BooksAndMore();
FileInputStream fis = null;
ObjectInputStream in = null;
try
{
fis = new FileInputStream(fileName);
in = new ObjectInputStream(fis);
company = (Company)in.readObject();
in.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
catch (ClassNotFoundException ex)
{
ex.printStackTrace();
}
return company;
}{code}
What am I doing wrong?