Online Java Compiler By
JavaTpoint.com
public class JavaByteCompareExample3 { public static void main(String[] args) { byte b1=Byte.MAX_VALUE; byte b2=Byte.MIN_VALUE; int val=Byte.compare(b1,b2); if(val>0){ System.out.println(b1+" is greater than "+b2); } else{ System.out.println(b2+" is greater than "+b1); } } }
Output