Short equals() method in Java with Examples Read Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report 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. Syntax ShortObject.equals(Object a) 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: Example 1: // Java code to demonstrate // Short equals() method class GFG { public static void main(String[] args) { // creating a Short object Short a = new Short("20"); // creating a Short object Short b = new Short("20"); // equals method in Short class boolean output = a.equals(b); // Printing the output System.out.println("Does " + a + " equals " + b + " : " + output); } } Output: Does 20 equals 20 : true Example 2: // Java code to demonstrate // Short equals() method class GFG { public static void main(String[] args) { // creating a Short object Short a = new Short("2"); // creating a Short object Short b = new Short("20"); // equals method in Short class boolean output = a.equals(b); // Printing the output System.out.println("Does " + a + " equals " + b + " : " + output); } } Output: Does 2 equals 20 : false Feeling lost in the vast world of Backend Development? It's time for a change! Join our Java Backend Development - Live Course and embark on an exciting journey to master backend development efficiently and on schedule. What We Offer: Comprehensive Course Expert Guidance for Efficient Learning Hands-on Experience with Real-world Projects Proven Track Record with 100,000+ Successful Geeks Last Updated : 05 Dec, 2018 Like Article Save Article Previous How compare() method works in Java Next Difference Between next() and hasNext() Method in Java Collections Share your thoughts in the comments Add Your Comment Please Login to comment...