Use Integer constructor to convert int primitive type to Integer object. : Wrapper Classes « Data Type « Java Tutorial






public class Main {

  public static void main(String[] args) {
    int i = 10;
    Integer intObj = new Integer(i);
    System.out.println(intObj);
  }
}








2.17.Wrapper Classes
2.17.1.Wrapper classes for the primitive types
2.17.2.Primitive Wrappers in detail
2.17.3.Demonstrate a type wrapper.
2.17.4.Autoboxing/unboxing int
2.17.5.Use Integer constructor to convert int primitive type to Integer object.
2.17.6.Wrapped Class: boolean, int, long