SE450
:
The toString Method
[22/86]
Returns a string representation of the object
Useful for debugging
Example:
Rectangle.toString
returns something like
java.awt.Rectangle[x=5,y=10,width=20,height=30]
toString
used by concatenation operator
aString + anObject
means
aString + anObject
.toString()
Object.toString
prints class name and object address
System.out.println(System.out)
yields
java.io.PrintStream@d2460bf
Implementor of
PrintStream
didn't override
toString
: