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

Convert long primitive to Long Object example

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

Post new comment

11 + 7 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.