Java Character compare() MethodThe compare(char x, char y) method of Character class is used to compare two char values numerically. The final value returned is similar to what would be returned by: SyntaxParameterThe above method requires two parameters:
Return ValueThe compare(char x, char y) method of character class returns
Example 1Test it NowOutput: First value is less than the second value. Example 2Test it NowOutput: Value 1 is greater than the value 2. Example 3Test it NowOutput: First and second values are equal. First value is less than the third value.
Next TopicJava Character
|