Can we change wrapper class into primitive data types?

can we change wrapper to primitive ?if not then what is happening in this code

int I = Integer.valueOf(46);
System.out.println(I);

I am not getting any error.

Jon Skeet
people
quotationmark

Yes, this is called unboxing:

Integer boxed = 10; // Boxing
int unboxed = boxed; // Unboxing

Boxing conversions are described in JLS 5.1.7; unboxing conversions are described in JLS 5.1.8.

Note that if you try to unbox a null reference, a NullPointerException will be thrown:

Integer boxed = null;
int unboxed = boxed; // NPE

people

See more on this question at Stackoverflow