I was making a code and by mistake I ended up putting double
and the IDE accepted, I always used it with D .
What's the difference between the two?
I was making a code and by mistake I ended up putting double
and the IDE accepted, I always used it with D .
What's the difference between the two?
double
is a primitive data type (that is, it is not created by reference, in other words, it is not an object). Not being an object, you do not have access to a number of features that the manipulation of objects offers, perhaps the most important being the conversion of a double
value to text ( String
) and the use of collections ( ArrayList
, Set
, etc.), since they only deal with objects and not primitives.
double
is the Double
.
The Double
class involves a value of the primitive type double
in an object. An object of type Double
contains a single field whose type is double
.
In addition, this class provides several methods for converting a double
to a String
and a String
into a double
, as well as other constants and methods useful when dealing with a double
. p>
Source: link
In summary, the classe Double
is a wrapper
.
See more about Wrappers
here .