using java equals () function and instanceof

(1) the value of "==" compares two variables itself, that two objects first address in memory.

"Equals ()" included in the contents of the comparison string are the same.

(2) java in instanceof operator is used to indicate whether the object at run time an instance of a particular class. instanceof to returns an indicated by a Boolean value, whether the object is an instance of a particular class or that its subclasses. Usage:
the Result = Object class instanceof

Parameters:
the Result: Boolean type.
Object: Required. Any object expression. Class: Required. Any object class defined. Note:
If the object is of class - one example, the instanceof operator returns true. If the object is not eleven instance specified class or object is null, false is returned.

Guess you like

Origin www.cnblogs.com/chenxue-wscls/p/11610147.html