ToStringPrints
DRAFT

Misconception:

Calling the toString() method on an object will print something.

Incorrect

Invoking toString() prints something

Correct

Invoking toString() does not produce any output

Correction
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”.

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.