== 和 equals() 的区别(==And equals())

==

  • 对基本数据类型来说:== 比较的是值
  • 对引用数据类型来说:== 比较的是对象的内存地址

equals()

比较字符串中所包含的内容是否相同

equals()
————————

==

  • For basic data types: = = compares values
  • For reference data types: = = compares the memory address of the object

equals()

Compare whether the contents contained in the string are the same

equals()