[5090] in java-interest
Documentation for Strings.substring() and the == operator
daemon@ATHENA.MIT.EDU (Walter Szewelanczyk)
Sun Jan 28 20:14:51 1996
From: "Walter Szewelanczyk" <Walter@stumpy.adco.com>
To: Pat Niemeyer <pat@icon-stl.net>, java-interest@java.sun.com
Date: Sun, 28 Jan 1996 18:51:27 +0000
Thanks Pat,
I looked but could not find documentation on this. I am obviously
not looking in the correct places. Can anyone refer me to where this
is documented.
> "==" is a test for identity not for equality.
> You should always use equals() instead.
>
> Because strings are immutable, they can be shared and you will find that
> Java sometimes gives you the same reference for identical strings.
> This happens, for example, when you embed two identical literal string
> references in the same class. But when you take a substring, or some other
> behavior the string may be copied.
>
Thanks
Walt
********************************************************************************************
Walter Szewelanczyk Technical Director
Walter@adco.com NET VENTURE, Inc.
"One must stay in a very RIGID state of FLEXABILITY"
********************************************************************************************
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com