Wednesday, 15 May 2013

c# - Question about Object Identity and Object Equality and String class exception -


This is Java and C # questions We all know that object identities (==) test whether the two objects Examine the same place and object equation (equal law) that two separate (non-identical) objects have the same value or not. But in the case of string object object recognition, the object similarity is similar, for example if two bullion expressions are correct in the statement

  string a = "123"; String b = "123"; If (a == b) if (a.Equals (b))  

Why is it ?? What is the rationale behind this design decision? Both Java and C # have used memory-saving techniques because wire is irreversible in these languages.

, They can combine frequently-used stars (such as hard-coded strings as your example are literally) and use several references to a string in memory to save space.


No comments:

Post a Comment