| Return | Method | Summary |
|---|---|---|
| int | compareTo(Boolean b) | Compares this Boolean instance with another. |
| boolean | equals(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:
| Return | Meaning |
|---|---|
| zero | if this object represents the same boolean value as the argument; |
| a positive value | if this object represents true and the argument represents false; |
| a negative value | if this object represents false and the argument represents true |
public class Main {
public static void main(String[] args) {
Boolean boolean1 = new Boolean("true");
System.out.println(boolean1);
Boolean boolean2 = new Boolean(true);
System.out.println(boolean2.compareTo(boolean1));
}
}
The output:
true
0java2s.com | | Contact Us | Privacy Policy |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |