Java Boolean.compareTo(Boolean b)
Syntax
Boolean.compareTo(Boolean b) has the following syntax.
public int compareTo(Boolean b)
Example
In the following code shows how to use Boolean.compareTo(Boolean b) method.
public class Main {
public static void main(String[] args) {
Boolean boolean1 = new Boolean("true");
System.out.println(boolean1);/*from w w w . jav a 2 s.co m*/
Boolean boolean2 = new Boolean(true);
System.out.println(boolean2.compareTo(boolean1));
}
}
The output: