This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

toString

 
vuthlarhi donald
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 12198
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://faq.javaranch.com/java/UseCodeTags
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think I understand what you're asking, but I'll take a wild guess...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic