Java Character equals() MethodThe equals(Object obj) method of character class compares the object with the specified object. The result is true if and only if the argument is not null and the Character object has the same char value as represented by the object. SyntaxParameterThe above method requires only one parameter: The object that needs to be compared. Return ValueThe equals(Object obj) method returns true if the objects are same. Otherwise, the method returns false. Example 1Test it NowOutput: They are equal. Example 2Test it NowOutput: They are not equal. Example 3Test it NowOutput: The numbers are equal. Example 4Test it NowOutput: The numbers are not equal.
Next TopicJava Character
|