Double is an object and double is a primitive data type. See this answer for more details.

The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double.

Source: http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html

Answer from But I'm Not A Wrapper Class on Stack Overflow
🌐
Coderanch
coderanch.com › t › 750518 › java › difference-double-Double-java
What is the difference between 'double' and 'Double' in java? (Beginning Java forum at Coderanch)
Basically, Java can convert between double and Double automatically to reduce the amount of code you have to write. The problem with getting rid of the "undesirables" is that sooner or later someone will decide that YOU are an undesirable. ... I have tried this and it throws a NullPointerException on line 10. So, what appears to be happening is that the call on line 14 gets resolved to add(Double, Double) because of the null value passed in...
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Float-vs-Double-Whats-the-difference
Java double vs float: What's the difference?
Both data types represent numbers with decimals, but a float is 32 bits in size while a double is 64 bits. A double is twice the size of a float — thus the term double. In Java, the Float and Double wrapper classes have two properties that ...
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › Double.html
Double (Java Platform SE 8 )
October 20, 2025 - Compares two Double objects numerically. There are two ways in which comparisons performed by this method differ from those performed by the Java language numerical comparison operators (<, <=, ==, >=, >) when applied to primitive double values:
🌐
Reddit
reddit.com › r/learnprogramming › should i always use doubles in java?
r/learnprogramming on Reddit: Should I always use doubles in Java?
February 19, 2022 -

I was playing around in an editor and divided 9 by 2 and to my surprise it truncated the decimal so I got 4 instead of 4.5. So I was like, oh right, so must be / floor division, it just truncates the decimal.

So then I tried to do 4 // 5, which is either invalid because / must be the escape character, or I can't do regular division because they're both ints, not sure which, but I got an error.

If I create 9 as a double and try 9 / 2, it divides correctly and I get 4.5

Should I always use doubles just in case? What if there's an instance where a large program uses ints and outputs unexpected numbers because the decimals have all been truncated?

🌐
Programming.Guide
programming.guide › java › double-vs-double.html
Java: Double (class) vs double (primitive) | Programming.Guide
Double is the wrapper type for the primitive type double. Objects of type Double are often referred to as boxed values. The fundamental difference is that Double is a class defined in the standard library, while double is part of the language itself.
🌐
Coderanch
coderanch.com › t › 409330 › java › Double-double-difference
Double and double - what's the difference? (Beginning Java forum at Coderanch)
Double is a class. double is a key word used to store integer or floating point number. ... It returns double, not Double. That should solve your problem. You should have got a compile time error because of this. However, if you are using JDK 1.5 or above then you would not get this problem.
Find elsewhere
🌐
Oracle
forums.oracle.com › ords › apexds › post › double-vs-double-5342
Double vs double - Oracle Forums
December 1, 2010 - Hi guys. I'm new to Java and I'm trying to understand what is the difference between Double and double in term of instantiation and equality? Thank you.
🌐
YouTube
youtube.com › alex lee
Double In Java - Double VS Int - YouTube
$1,000 OFF ANY Springboard Tech Bootcamps with my code ALEXLEE. See if you qualify for the JOB GUARANTEE! 👉 https://bit.ly/3HX970hIn this video, I show you ...
Published   June 15, 2023
Views   10K
🌐
DataCamp
datacamp.com › doc › java › double
double Keyword in Java: Usage & Examples
Java keywordsIntroduction To JavaJava File HandlingJava Language BasicsJava ArraysJava Object-Oriented Programming ... The double keyword in Java is a primitive data type that represents a double-precision 64-bit IEEE 754 floating point.
🌐
Baeldung
baeldung.com › home › java › java numbers › float vs. double in java
Float vs. Double in Java | Baeldung
January 4, 2025 - Choosing between float and double in Java requires understanding the trade-offs in precision, memory usage, and application needs.
🌐
Simplilearn
simplilearn.com › home › resources › software development › float vs double in java: key differences you should know
Float vs Double in Java: Key Differences You Should Know
November 17, 2025 - Explore the key differences between float and double in Java. Our comprehensive guide helps you choose the right type for your Java applications. Perfect for new coders!
🌐
Medium
medium.com › @qingedaig › java-bigdecimal-vs-double-vs-float-012c7149e550
Java BigDecimal vs double vs float | by Alice Dai | Medium
October 15, 2024 - Precision: Use BigDecimal for precise calculations, particularly in financial applications. Performance: Use double for general floating-point arithmetic when performance matters but precision is not critical.
🌐
Sololearn
sololearn.com › en › Discuss › 713076 › what-is-the-difference-between-int-and-double-in-java
What is the difference between int and double in java | Sololearn: Learn to code for FREE!
java · 14th Sep 2017, 6:40 AM ... AM · 👑 Prometheus 🇸🇬 · + 6 · addition to @ vengat Int is whole numbers while double is floating point numbers ·...
🌐
Scaler
scaler.com › home › topics › float vs double in java - difference you should know
Float Vs Double in Java - Difference You Should Know - Scaler Topics
March 27, 2024 - As the Float consumes less memory in comparison to the Double data type. By default, Java treats any decimal or float numbers as double type, so in case, if we want to define any value as float, we need to manually typecast it using the 'f' or 'F' keyword in the suffix of the number.
🌐
Blogger
javarevisited.blogspot.com › 2016 › 05 › difference-between-float-and-double-in-java.html
Difference between float and double variable in Java? Example
Here are some key differences between float and double in Java : 1. The double data type is more precise than float in Java. 2. double-takes more space than float in Java. double needs 64-bit storage compare to 32-bit storage of float data type.
🌐
Java
download.java.net › java › early_access › valhalla › docs › api › java.base › java › lang › Double.html
Double (Java SE 23 & JDK 23 [build 1])
The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double format" bit layout. If the argument is 0x7ff0000000000000L, the result is positive infinity. If the argument is 0xfff0000000000000L, the result is negative infinity. If the argument is any value in the range 0x7ff0000000000001L through 0x7fffffffffffffffL or in the range 0xfff0000000000001L through 0xffffffffffffffffL, the result is a NaN. No IEEE 754 floating-point operation provided by Java can distinguish between two NaN values of the same type with different bit patterns.
🌐
Quora
quora.com › What-is-the-difference-between-using-double-for-floating-point-numbers-in-Java-as-opposed-to-using-float-or-long-in-C-C
What is the difference between using double for floating point numbers in Java as opposed to using float or long in C/C++? - Quora
Answer (1 of 2): Disclaimer: I am not a Java expert Question is sort of confusing. A long is an integral type, so I think we can ignore that part of the question. Computer languages provide some level of abstraction over the CPU. But that doesn’t mean they abandon the capabilities of the CPU an...