I know this was asked so many times but I can't get the grasp of it. I have this method:
public static void toFile() throws FileNotFoundException{
PrintWriter oFile = new PrintWriter("Output.csv");
oFile.println("Tipas,Vadovas,Pavadinimas,Produktas(MB),Darbuotojai(UAB)");
Company Com = companyList.get(companyList.size()-1);
Company.csv(Com, oFile);
oFile.close();
}
On the line Company.csv(Com, oFile);
I get error non-static method cannot be referenced from a static context
csv method looks like this
public void csv(Company Com,PrintWriter oFile){
oFile.print("Kita");
oFile.println(b+","+n+","+","+"-"+","+"-");
}
As I understood I should have instance variables when passing but I think I can't do this (am I right?)
*NOTE: Company class have two child classes with csv method. Don't know if this helps.