Friday, 6 September 2013

toString method declaration in Java

toString method declaration in Java

I have a toString to declare within a method in my class. However, I am
not sure if this is the correct way or syntax to declare the to String
public String toString() {
return "\nBank name:\t\t" + bankName + "\nBank ID:\t\t" + bankID +
"\nBank address:\t\t" + bankAddress + "\n\n";
}

No comments:

Post a Comment