Open In App

Boolean equals() method in Java with examples

Last Updated : 11 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report
The equals() method of Boolean class is a built in method of Java which is used check equality of two Boolean object. Syntax:
BooleanObject.equals(Object ob)
Parameter: It take a parameter ob of type Object as input which is the instance to be compared. Return Type: The return type is boolean. It returns true if the specified Object 'ob' has same value as the 'BooleanObject', else it returns false. Below are programs to illustrate the equals() method of Boolean class: Program 1:
Output:
true comparing with true = true
Program 2:
Output:
true comparing with false = false
Program 3:
Output:
false comparing with true = false

Practice Tags :

Similar Reads