Hi, i need to call a toString method in another one of my toString methods, however i am getting a compiling erroe each time, can anyone look at the code below and let me know what i have done wrong?
Thanks in advance.
(Contact class)
public String toString() { String output = "First Name: " + fName + "\n" + "Second Name: " + sName + "\n" + "Street " + street + "\n" + "Town: " + town + "\n" + "Postcode: " + postcode; return output; }
(AddPersonalContact class)
public class AddPersonalContact extends Contact . . . . . public String toString() { String output = Contact.toString() + "\n" + "Phonenumber: " + phonenumber; return output; }
**EDIT**
Sorry, forgot the compiling error:
non-static method toString() cannot be referenced in a static context