Online Java Compiler By
JavaTpoint.com
public class CompareToExample1 { public static void main(String[] args) { //both have same value Short s1 = 45; Short s2 = 45; //implementing compareTo() method to compare two Short values int result=s1.compareTo(s2); System.out.println("when Short s1=45 & s2=45 (both have same Value ) = " + result); } }
Output