Java Byte.compareTo(Byte anotherByte)
Syntax
Byte.compareTo(Byte anotherByte) has the following syntax.
public int compareTo(Byte anotherByte)
Example
In the following code shows how to use Byte.compareTo(Byte anotherByte) method.
public class Main {
public static void main(String[] args) {
// w w w. java2 s . c o m
Byte byte1 = new Byte("1");
Byte byte2 = new Byte("2");
System.out.println(byte1.compareTo(byte2));
}
}
The output: