The equals() method of Short class is a built in method in Java which is used to compare the equality given Object with the instance of Short invoking the equals() method.
Parameters: It takes an Object type object a as input which is to be compared with the instance of the Short object calling the equals method.
Return Value: It return an boolean value. It returns true if the value of ‘a’ is equal to the value of ShortObject.
Below is the implementation of equals() method in Java:
Does 20 equals 20 : true
Does 2 equals 20 : false
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.