Java Boolean equals() methodThe equals() method of Java Boolean class returns a Boolean value. It returns true if the argument is not null and is a Boolean object that represents the same Boolean value as this object, else it returns false. Syntax:Parameters:Obj - The object to compare with Return Value:This method returns a Boolean value,
Example 1Test it NowOutput: equals() method returns false Example 2Output: Enter your percentage. 60 Sorry! You have failed. You needed 4.0 more marks to pass. Try again next year. Example 3Output: Enter two number. 78 0 Divide = 78/0 Division is not possible.
Next TopicJava Boolean
|