Constant Interpretation Corresponding String
Float.MAX_VALUE The largest number representable 3.40282e+038
Float.MIN_VALUE The smallest number representable 1.4013e-045
Float.NEGATIVE_INFINITY Negative divided by zero -Infinity
Float.POSITIVE_INFINITY Positive divided by zero Infinity
Float.NaN Not a Number NaN
NaN stands for Not a Number
Float.NaN
Float.NEGATIVE_INFINITY
Float.POSITIVE_INFINITY
Double.NaN
Double.NEGATIVE_INFINITY
Double.POSITIVE_INFINITY
publicclass MainClass {
publicstaticvoid main(String[] a) {
double d = -10.0 / 0.0;
if (d == Double.NEGATIVE_INFINITY) {
System.out.println("d just exploded: " + d);
}
}
}