Double d1 = 25d;
Double d2 = 25d;
if (d1 == d2) {
System.out.println("equal (==)");
} else if (d1.equals(d2)) {
System.out.println("equal (using equals() method)");
}
The output is:
equal (using equals() method)
No comments:
Post a Comment