Byte compareTo(Byte anotherByte)
compares two Byte objects.
compareTo
has the following syntax.
public int compareTo(Byte anotherByte)
compareTo in interface Comparable<Byte>
compareTo
has the following parameters.
compareTo
returns
In the following code shows how to use Byte.compareTo(Byte anotherByte) method.
public class Main { public static void main(String[] args) { Byte byte1 = new Byte("1"); Byte byte2 = new Byte("2"); System.out.println(byte1.compareTo(byte2)); } }
The output: