Im attempting to write a previously created array to file. This is the error im getting and I don\'t know how to fix it.
Zoo.java:341: error: no suitable method
Animals is a class that Java doesn't know how to convert it to String, int, or char.
I assume you want to write Animals instance data to file Output.txt.
In that case, you should define toString() method in Animals class, so the print function can convert the instance to string and write that to the file.
class Animals {
String name;
@Override
public String toString() {
return "Animal name : " + name;
}
}
See:
http://www.javatpoint.com/understanding-toString()-method