why does ReferenceEquals(s1,s2) returns true

前端 未结 5 1431
遥遥无期
遥遥无期 2021-01-07 23:52
  String s1 = \"Hello\";
  String s2 = \"Hello\";

Here s1, s2 are different but then why ReferenceEquals() is returning true

5条回答
  •  别那么骄傲
    2021-01-08 00:18

    Strings are immutable, once it created in the memory following same String objects are refered to the previously created String object for more http://msdn.microsoft.com/en-us/library/362314fe.aspx

提交回复
热议问题