NoStringToString
DRAFT

Misconception:

If you have an object of type String, you can’t invoke toString() on it, because it already is a String.

Incorrect

One cannot invoke toString() on a String

Correct

One can invoke toString() on a String

Correction
Here is what's right.

The toString() method is declared in class java.lang.Object, and thus inherited by java.lang.String (a subclass of java.lang.Object). As such, it’s perfectly legal to invoke toString() on a String object. The result will be the object itself, so the invocation is really unnecessary:

String s = ...;
assert s.toString() == s;

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.