You need to sign in to do that
Don't have an account?
Doug Beltowski X
Error when trying to implement toString method on a custom class
I'm trying to implement a toString method on a custom class I've created. However whenever I try to save I get the error. "Method must use the override keyword: String toString()". I'm not sure exactly what I'm doing wrong. Below is my code.
csvCell is defined as a private String.
public String toString() { return csvCell; }
csvCell is defined as a private String.
e.g.
The only thing is that as far as I know, toString() is not a method on the String class. It basically calls the "String.valueOf()" method on the object your trying to coerce. Either way, I hope this helps!