The Java basic type has a package class, so that you can create a non-basic object in the heap to indicate the corresponding basic type.
Java's automatic packaging function is to automatically convert the basic type to the packaging type, and can reverse conversion.
Exercise: WriteProgramTo verify that the automatic packaging function works for all basic types and package types.
Exercise 9: (2) write a program that demonstrates that autoboxing works for all the primitive types and their wrappers.
public class autoboxtest {public static void main (string [] ARGs) {Boolean B = false; char c = 'X '; byte T = 8; short S = 16; int I = 32; long l = 64; float F = 0.32f; double D = 0.64; Boolean B = B; system. out. println ("Boolean B =" + B); system. out. println ("Boolean B =" + B); character C = C; system. out. println ("char c =" + C); system. out. println ("character c =" + C); byte T = T; system. out. println ("Byte T =" + T); system. out. println ("Byte T =" + T); short S = s; system. out. println ("short S =" + S); system. out. println ("short S =" + S); integer I = I; system. out. println ("int I =" + I); system. out. println ("integer I =" + I); long l = L; system. out. println ("Long L =" + l); system. out. println ("Long L =" + l); float F = f; system. out. println ("float F =" + F); system. out. println ("float F =" + F); double D = D; system. out. println ("Double D =" + d); system. out. println ("Double D =" + d) ;}