DRAFT
ToStringPrints
Misconception:
Calling the toString()
method on an object will print something.
Incorrect
Invoking toString() prints something
Correct
Invoking toString() does not produce any output
CorrectionHere is what's right.
Here is what's right.
The toString()
method does not cause any output. It simply returns a String
.
This is related to a more general misunderstanding of “outputting” and “returning values”.
Language
Java