Convert long primitive to Long object - Java Language Basics

Java examples for Language Basics:long

Description

Convert long primitive to Long object

Demo Code


public class Main {
 
  public static void main(String[] args) {
    long i = 10;/*from   ww  w.  j a va2s .  co  m*/
   
    /*
    Use Long constructor to convert long primitive type to Long object.
    */
   
    Long lObj = new Long(i);
    System.out.println(lObj);
   
  }
}

Result


Related Tutorials