IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    How to distinguish between == and .equals() method in Java

    xiantang - Self-discipline set me free.发表于 2019-02-24 14:40:53
    love 0
    Generally speaking, equals() and "==" operator are used to compare whether two objects are equal, but there are many differences between the two: The main difference is that .equals() is a method, == is an operator. Use == to compare references, referring to whether they point to the same memory address. Use .equals() to compare the content of objects, comparing values. If .equals is not overridden, it will default to calling the nearest superclass to override this method.


沪ICP备19023445号-2号
友情链接