Short.compareTo(Short anotherShort) has the following syntax.
public int compareTo(Short anotherShort)
In the following code shows how to use Short.compareTo(Short anotherShort) method.
public class Main { public static void main(String[] args) { Short shortValue1 = new Short("10"); Short shortValue2 = new Short("11"); System.out.println(shortValue1.compareTo(shortValue2)); } }
The output: