Java essays == and equals the difference between the

And equals the difference between ==
== is an operator for comparing for equality the contents of both ends of the
basic data types: whether the value of the two ends are equal
reference types: comparing the (address of the memory pointed to) the reference value is equal

equals (): it is a subclass of Object method after the inheritance of this method
can be logically they need to cover the needs of this method
thus described his "are logically" comparison rules
, for example: String class will equals () cover to compare the contents of strings

Guess you like

Origin www.cnblogs.com/wangshuangpan/p/java.html
Recommended