wood burning stoves
The moose likes Beginning Java and the fly likes toString Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "toString" Watch "toString" New topic


vuthlarhi donald
Ranch Hand

Joined: Jul 31, 2006
Posts: 76
how can I ensure that the other methods hav a toString method, not only one method

public void setName(String name)
this.name = name;

public String getSurname()
return surname;

public void setSurname(String surname)
this.surname = surname;

public String getAddress()
return address;

public void setAddress(String address)
this.address = address;
public String toString()
return "Person:" + getName();
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11923

I don't understand the question. methods don't have methods. Since every class will inherit a toString() method from the Object class (although it's probably not what you want).

Can you re-phrase what you are asking?

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457

Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
marc weber

Joined: Aug 31, 2004
Posts: 11343

I don't think I understand what you're asking, but I'll take a wild guess...

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link: http://aspose.com/file-tools
subject: toString
It's not a secret anymore!