Java Long compare() MethodThe compare() method of Java Long class is used to compare two long objects numerically. Syntax:Parameter:The above method consists of two parameters:
Return:The above method returns:
Example 1Test it NowOutput: The value '76' is greater than 42 Example 2Output: Enter your valid age: 35 You are eligible to vote. Example 3Output: Enter your birth year : 2020 PLEASE enter a valid birth year.
Next TopicJava Long
|