- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
- Related Articles
- Java Program to convert Double to numeric primitive data types
- Convert a String to a double type number in Java
- Convert short primitive type to Short object in Java
- Convert byte primitive type to Byte object in Java
- How to Convert Double to String to Double in Java?
- Format double type in Java
- Convert double to string in Java
- Convert Double to Integer in Java
- Convert String to Double in Java
- Convert double value to string in Java
- Golang Program to convert double type variables to int
- Golang Program to convert double type variables to string
- Swift Program to convert int type variable to double
- Swift program to convert double type variables to int
- Swift program to convert double type variable to string

Advertisements