Java中==和equals()有什么区别? - What is the difference between == and equals() in Java?

问题:

I wanted to clarify if I understand this correctly: 我想澄清一下我是否正确理解了这一点: this

  • == is a reference comparison, ie both objects point to the same memory location ==是参考比较,即两个对象都指向相同的存储位置
  • .equals() evaluates to the comparison of values in the objects .equals()计算对象中值的比较

解决方案:

参考一: https://stackoom.com/question/VYPI/Java中-和equals-有什么区别
参考二: https://oldbug.net/q/VYPI/What-is-the-difference-between-and-equals-in-Java
相关文章
相关标签/搜索