Java Byte compareTo() methodThe compareTo() method of Java Byte class compares two Byte objects numerically Syntax:Parameters:The parameter 'anotherByte' represents the Byte to be compared. Specified byThis method is specified by compareTo in interface Comparable<Byte> Return ValueThis method returns an integer value.
Example 1Test it NowOutput: 127 is greater than 67 . Example 2Output: Enter your age : 24 Congratulations! You are an adult. Now you can vote. Example 3Test it NowOutput: Error:(5, 18) java: incompatible types: int cannot be converted to java.lang.Byte Next TopicJava Byte |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India