Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between "Double" and "double" in Java? [duplicate]

Tags:

java

double

What is the difference between Double and double?

like image 777
Ashwin Shirva Avatar asked Dec 07 '13 02:12

Ashwin Shirva


People also ask

What is double in Java data type?

What is double in Java “double” is a data type that stores floating point numbers. It is similar to a float data type. Unlike, a float which stores 32 bit IEEE 745 floating point numbers, double stores 64-but IEEE 754 floating point numbers.

What is the difference between a long and a double in Java?

In brief, long is an integral type whereas double is a floating point type. 1.Java Data Types, Available here. 2.“Data Types in Java.” GeeksforGeeks, 7 Sept. 2018, Available here.

What is the difference between double and double in C++?

Doubleis an object and doubleis 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

Is double a reference type or a value type?

Double is reference type and double is value type. 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." link As @Fess mentioned and because Double is reference type it can be null.


1 Answers

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

like image 115
But I'm Not A Wrapper Class Avatar answered Oct 15 '22 00:10

But I'm Not A Wrapper Class