27 lines
664 B
Plaintext
27 lines
664 B
Plaintext
The ``++String++`` class has a ``++toString++`` method because ``++Object++`` itself does. I.e. it couldn't not have the method. But having the method doesn't mean it should be used. In fact doing so is worse than pointless since it returns the ``++String++`` itself.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
String str1 = "Now is the time for all good people";
|
|
String str2 = str1.toString();
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
String str1 = "Now is the time for all good people";
|
|
String str2 = str1;
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|