Java_equals与“==”

  1) For ==, if applied to the basic data types of variables, which directly comparing "value" is stored are equal;

    If applied to a reference type variable, the address comparison is pointed object

  2) For the equals method, note that: equals method can not be applied to the basic data types of variables

    If there is no rewriting of the equals method, the address comparator is a reference to the object type variable points;

    Such as a String, Date, etc. based on the rewritten equals method then compares the contents of the object pointed to.

  More follow-up supplement

Guess you like

Origin www.cnblogs.com/Qiav/p/12089008.html