Online Java Compiler By
JavaTpoint.com
public class JavaByteCompareExample1 { public static void main(String[] args) { byte byte1=3; byte byte2=67; int val=Byte.compare(byte1,byte2); if(val==0){ System.out.println(byte1+" and "+byte2+" values are equal."); } else if(val>0){ System.out.println(byte1+" is greater than "+byte2+" ."); } else{ System.out.println(byte2+" is greater than "+byte1+" ."); } } }
Output