Boolean equals() method in Java with examples
The equals() method of Boolean class is a built in method of Java which is used check equality of two Boolean object.
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:
true comparing with true = true
true comparing with false = false
false comparing with true = false
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.