Java java.lang Boolean compare(boolean x, boolean y)
Description Of Boolean: compare(boolean x, boolean y)
The java.lang.Boolean.compare(boolean x, boolean y) Compares two boolean values. The value returned is identical to what would be returned by: Boolean.valueOf(x).compareTo(Boolean.valueOf(y))
Boolean.compare(boolean x, boolean y) method returns the value 0 if x == y; a value less than 0 if !x && y; and a value greater than 0 if x && !y
Code Example Java Boolean
public class BooleanExam {
public static void main(String[] args) {
Boolean x = new Boolean(true);
Boolean y = new Boolean(false);
Boolean x2 = new Boolean(true);
Boolean y2 = new Boolean(true);
int aBool = Boolean.compare(x, y);
int bBool = Boolean.compare(x2, y2);
System.out.println(aBool);
System.out.println(bBool);
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น