Explain equals() with example

Equals() verifies whether the number object is equal to the object, which is passed as an argument or not.
 
The syntax of the equals() method is :
public boolean equals(Object o)
This method takes two parameters 1) any object, 2) return value. It returns true if the passed argument is not null and is an object of a similar type having the same numeric value.
 
Example :
import java.lang.Integer;
public class Test { 
   public static void main(String args[]) {
      Integer p = 5;
      Integer q = 20;
      Integer r =5;
      Short s = 5;
      System.out.println(p.equals(q));  
      System.out.println(p.equals(r)); 
      System.out.println(p.equals(s));
   }
}