String comparison in Java

xiaoxiao2021-03-06  23

String comparison in Java

If you use strings to assign a value to string objects, such as string s1 = "hello"; string s2 = "hello"; then S1 == "Hello" and S1 == S2 judgment result is true

However: String S1 = "Hello"; Stirng S2 = New String ("Hello"); then the judgment of S1 == S2 is false, and S1.Equals (S2) can be used to determine

I don't know how the String class is assigned to the String class in Java, how is the operator overload mechanism?

转载请注明原文地址:https://www.9cbs.com/read-39412.html

New Post(0)