Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Convert double primitive to Double Object example

  1. /*
  2.  * Convert double primitive to Double Object example. Program to convert Java
  3.  * double primitive data type to Double object.
  4.  */
  5.  
  6. public class DoublePrimitiveToDouble {
  7.  
  8.  public static void main(String args[]){
  9.  
  10.   //new double primitive
  11.   double d = 5.74;
  12.  
  13.   //Use Double(double d) constructor
  14.   Double dObj1 = new Double(d);
  15.  
  16.   System.out.println("double converted to Double object: " + dObj1);
  17.  
  18.  }
  19. }
No votes yet
Share this

Post new comment