Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Convert double primitive type to a Double object in Java
To convert double primitive type to a Double object, you need to use Double constructor.
Let’s say the following is our double primitive.
// double primitive double val = 23.78;
To convert it to a Double object, use Double constructor.
// Double object Double ob = new Double(val);
Example
public class Demo {
public static void main(String args[]) {
// double primitive
double val = 23.78;
// Double object
Double ob = new Double(val);
System.out.println(ob);
}
}
Output
23.78
Advertisements
