![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
Advertisements