Difference between Equals/equals and == operator?

前端 未结 11 1001
一生所求
一生所求 2020-11-22 14:14

What is the difference between a == b and a.Equals(b)?

11条回答
  •  青春惊慌失措
    2020-11-22 15:07

    == checks the Object reference, basically it compares the hashcodes. Equals uses the contents in the object. Remember, we have to override the .equals method accordingly in our class.

提交回复
热议问题