Web Log di Adrian Florea

"You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away." Antoine de Saint-Exupery
posts - 440, comments - 2715, trackbacks - 3944

My Links

Archives

Post Categories

Image Galleries

.RO Blogs

.RO People

.RO Sites

Blogs

Furls

Links

vinCitori

String ==-ity in Java e C# (cosa dicono gli standard)

In riferimento al mio post precedente, vediamo cosa dicono gli standard:

Java Language Specification, 2nd edition Standard ECMA-334. C# Language Specification, 2nd edition
15.21.3
While == may be used to compare references of type String, such an equality test determines whether or not the two operands refer to the same String object. The result is false if the operands are distinct String objects, even if they contain the same sequence of characters. The contents of two strings s and t can be tested for equality by the method invocation s.equals(t).

3.10.5
Strings computed at run time are newly created and therefore distinct.
14.9.7 (p. 167)
Two string values are considered equal when one of the following is true:
  • Both values are null.
  • Both values are non-null references to string instances that have identical lengths and identical characters in each character position.
The string equality operators compare string values rather than string references. When two separate string instances contain the exact same sequence of characters, the values of the strings are equal, but the references are different. [Note: the reference type equality operators can be used to compare string references instead of string values. end note]

Io voto per .NET :-)

Print | posted on domenica 13 giugno 2004 21:28 | Filed Under [ Carillon .NET ]

Powered by:
Powered By Subtext Powered By ASP.NET