The equals()  method of Integer class compares the given object to the specified object.


public boolean equals(Object obj)


The parameter ‘obj’ represents the object to be compared with.


The equals() method overrides equals in class Object

 Return Value

This method returns:

  • Boolean value true, if both the objects are identical
  • Else it returns false.

Example 1


Example 2


Pin It on Pinterest

Share This