A simple comparison of two double values in Java creates some problems. Let\'s consider the following simple code snippet in Java.
package doublecomparision;
Just use Double.compare() method to compare double values. Double.compare((d1,d2) == 0)
double d1 = 0.0; double d2 = 0.0; System.out.println(Double.compare((d1,d2) == 0)) // true