Comparison
In addition to comparing for equality with ==
and !=
, doubles
s can be compared to see if one is bigger than another using
>
, <
, >=
, and <=
.
This works the same as it does with int
s.
double x = 1.5;
double y = 0.2;
// true
System.out.println(x > y);
// false
System.out.println(x < y);