Java Short.compareTo(Short anotherShort)
Syntax
Short.compareTo(Short anotherShort) has the following syntax.
public int compareTo(Short anotherShort)
Example
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");
/*from w w w . ja v a2 s. c om*/
System.out.println(shortValue1.compareTo(shortValue2));
}
}
The output: