Compare two boolean values

intcompareTo(Boolean b)Compares this Boolean instance with another.
booleanequals(Object obj)Returns true if the argument is not null and is a Boolean object that represents the same boolean value as this object.

compareTo(Boolean b) returns:

zeroif this object represents the same boolean value as the argument;
a positive valueif this object represents true and the argument represents false;
a negative valueif this object represents false and the argument represents true

public class Main {
    public static void main(String[] args) {
       Boolean boolean1 = new Boolean("true");
       Boolean boolean2 = new Boolean(true);

The output:

0  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.