int and double have different semantics. Consider division. 1/2 is 0, 1.0/2.0 is 0.5. In any given situation, one of those answers will be right and the other wrong.

That said, there are programming languages, such as JavaScript, in which 64-bit float is the only numeric data type. You have to explicitly truncate some division results to get the same semantics as Java int. Languages such as Java that support integer types make truncation automatic for integer variables.

In addition to having different semantics from double, int arithmetic is generally faster, and the smaller size (32 bits vs. 64 bits) leads to more efficient use of caches and data transfer bandwidth.

Answer from Patricia Shanahan on Stack Overflow
🌐
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!
Integers are a set discrete numbers ... from positive to negative but this time with decimals. For example; 5 is an int and 5.2 is a double value....
🌐
Quora
quora.com › What-is-the-difference-between-integer-and-double-in-Java-programming-language
What is the difference between integer and double in Java programming language? - Quora
However Int is the most common and frequent data type used as compared to double..in layman language if u want to assign an integer type number to your variable like 1,2,3,4 etc..u use int…and if u want to assign fraction type number...
🌐
Coderanch
coderanch.com › t › 399930 › java › int-double
why use int over double? (Beginning Java forum at Coderanch)
Try something like this: This is just a simplistic example to show the difference between double and integer multiplication. I tried to make sure the only difference is in the multiplication operation itself, so I declared both time vars before the first test, removing any overhead for alotting them. Make sure you declare the variables volatile so the compiler won't optimize them out of the code. ... Timmy, i am just a beginner learning java...
🌐
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
🌐
Oreate AI
oreateai.com › blog › understanding-the-difference-int-vs-double-in-java › b3280a9cc3a6961d2ce3291f0adb2f05
Understanding the Difference: Int vs Double in Java - Oreate AI Blog
January 15, 2026 - Here lies one of the key differences ... while an int can only store whole values ranging from -2 billion to +2 billion approximately, a double can hold much larger ranges due to its ability to include fractional components but at a cost—it consumes ...
🌐
Reddit
reddit.com › r/c_programming › what is the difference between int and double and how do you know when to use them?
r/C_Programming on Reddit: What is the difference between int and double and how do you know when to use them?
February 6, 2015 - Well they can't really be interchanged. An int is used to represent integer numbers (+- whole numbers). While a double is used to represent a double precision floating point number.
🌐
GeeksforGeeks
geeksforgeeks.org › java › convert-double-to-integer-in-java
Convert Double to Integer in Java - GeeksforGeeks
... class GFG { public static void main(String[] args) { double data = 3452.345; System.out.println("Double : " + data); int value = (int) data; System.out.println("Integer : " + value); } }
Published   December 20, 2025
Find elsewhere
🌐
Reddit
reddit.com › r/javahelp › newbie: why would you use int over double ever?
r/javahelp on Reddit: Newbie: why would you use int over double ever?
August 8, 2015 -

So i am working my way through some tutorials. Ive started user inputed calculators. Super basic stuff i know.

I have found that i just use double instead of int. I feel that the double gives you more range.

So why would you use INT or DOUBLE? Thank you

🌐
Alvin Alexander
alvinalexander.com › java › java-int-double-float-mixed-type-division-arithmetic-rules
Java int, double, float, and mixed-type arithmetic rules | alvinalexander.com
As a proof of that statement, here’s the source code for a sample Java arithmetic program: public class Test1 { public static void main (String[] args) { System.out.println("3 / 2 = " + (3 / 2)); System.out.println("3 / 2.0 = " + (3 / 2.0)); System.out.println("3.0 / 2 = " + (3.0 / 2)); System.out.println("3.0 / 2.0 = " + (3.0 / 2.0)); } } ... Notice that dividing an int by an int in the first example results in an int, and that value isn’t what you might expect.
🌐
Quora
quora.com › What-is-the-difference-between-double-and-integer
What is the difference between double and integer? - Quora
Answer (1 of 2): Integer identifiers (variables or constant) can take only whole numbers as values. There are two varieties of it. One is unsigned whereas the another is signed. Moreover, they can be of different lengths. Popular lengths for integers are 2 bytes (Range 0:6535 or -32768:32767, 4 b...
🌐
Oracle
docs.oracle.com › javase › tutorial › java › nutsandbolts › datatypes.html
Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics)
In addition to the eight primitive data types listed above, the Java programming language also provides special support for character strings via the java.lang.String class. Enclosing your character string within double quotes will automatically create a new String object; for example, String s = "this is a string";. String objects are immutable, which means that once created, their values cannot be changed.
🌐
Quora
quora.com › What-is-the-difference-between-an-int-a-long-a-double-and-a-decimal-in-Java
What is the difference between an int, a long, a double and a decimal in Java? - Quora
Answer (1 of 5): There are eight primitive datatypes supported by Java. Primitive datatypes are predefined by the language and named by a keyword. int * Int data type is a 32-bit signed two's complement integer. * Minimum value is - 2,147,483,648 (-2^31) * Maximum value is 2,147,483,647(incl...
🌐
Baeldung
baeldung.com › home › java › java numbers › check if a double is an integer in java
Check if a double Is an Integer in Java | Baeldung
January 24, 2024 - A double can be considered as ... double holds a whole number without any fractional component. For example, 42.0D is actually an integer (42)....
🌐
Runestone Academy
runestone.academy › ns › books › published › csjava › Unit2-Using-Objects › topic-2-8-IntegerDouble.html
2.8. Wrapper Classes - Integer and Double — CS Java
For every primitive type in Java, there is a built-in object type called a wrapper class. The wrapper class for int is called Integer, and for double it is called Double. Sometimes you may need to create a wrapped object for a primitive type so that you can give it to a method that is expecting an object.
🌐
Software Testing Help
softwaretestinghelp.com › home › java › 3 methods to convert double to int in java
3 Methods To Convert Double To Int In Java
April 1, 2025 - In such scenarios, this double value is required to be converted to an int data type. For Example, to print average weight, height, etc., or bill generated, it is more preferred to represent the value as integer instead of number with floating-point.
🌐
W3Schools
w3schools.com › java › java_data_types.asp
Java Data Types
assert abstract boolean break byte case catch char class continue default do double else enum exports extends final finally float for if implements import instanceof int interface long module native new package private protected public return requires short static super switch synchronized this throw throws transient try var void volatile while Java String Methods
🌐
Sololearn
sololearn.com › en › discuss › 43536 › what-is-the-difference-between-integer-double
what is the difference between integer & double | Sololearn: Learn to code for FREE!
integer data type used for decimal numbers, and double is data type float data type double is used for pointing value example: double value is = 78.654 with point integer value is = 354678 without point · 9th Sep 2016, 8:45 AM · Abdul Jabbar ...