Autoboxing/unboxing int : Wrapper Classes « Data Type « Java Tutorial






class AutoBox {
  public static void main(String args[]) {

    Integer iOb = 100; // autobox an int

    int i = iOb; // auto-unbox

    System.out.println(i + " " + iOb); // displays 100 100
  }
}








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