Quantcast
Channel: Difference between double and Double in comparison - Stack Overflow
Browsing all 6 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Answer by malvern dongeni for Difference between double and Double in comparison

Difference between == and equalsusing == on primitive data types is not the same as using it on object reference data types.On primitive data types == is used as equals.for object reference data types...

View Article



Answer by Reimeus for Difference between double and Double in comparison

Content checking is only reliable for == when checking primitive types. For objects types it is always better to use the equals method:c.equals(d)

View Article

Answer by Jon Skeet for Difference between double and Double in comparison

When applied to expressions of a class type, == will always perform a reference comparison (JLS section 15.21.3). So this line:System.out.println(c == d); is checking whether c and d refer to the same...

View Article

Answer by Eng.Fouad for Difference between double and Double in comparison

Use equals() to checks the equality of 2 objects. == checks if the 2 references refer to the same object in the memory.

View Article

Answer by Tomasz Nurkiewicz for Difference between double and Double in...

c and d are technically two different objects and == operator compares only references. c.equals(d)is better as it compares values, not references. But still not ideal. Comparing floating-point values...

View Article


Difference between double and Double in comparison

I know that Double is a a wrapper class, and it wraps double number. Today, I have seen another main difference : double a = 1.0;double b = 1.0;Double c = 1.0;Double d = 1.0;System.out.println(a == b);...

View Article
Browsing all 6 articles
Browse latest View live


Latest Images