Java Q&A: The ultimate superclass, Part 3
See the original posting on JavaWorld
My previous post in this three-part series on the
java.lang.Object class and its methods covered
hashCode(). In this post, you explore
toString(), the wait/notification methods, and
Object‘s methods in an interface and Java 8 context.
Q: What does the
toString() method accomplish?
toString() method returns a string representation of the object on which this method is called. The returned string is useful for debugging purposes.
Q: What does the string representation look like when
toString() isn’t overridden?