(a) What is a wrapper class?
(b) Autoboxing is the automatic conversion between a primitive value and a
corresponding wrapper object. Write two examples to explain the concepts
of autoboxing and unboxing between int and Integr.
2006-06-22 15:00:13 · 1 個解答 · 發問者 明煒 1 in 電腦與網際網路 ➔ 程式設計
(a) What is a wrapper class? Wrapper class is wrapper around a primitive data type. An instance of a wrapper class contains, or wraps, a primitive value of the corresponding type. Following table lists the primitive types and the corresponding wrapper classes:PrimitiveWrapperbooleanjava.lang.Booleanbytejava.lang.Bytecharjava.lang.Characterdoublejava.lang.Doublefloatjava.lang.Floatintjava.lang.Integerlongjava.lang.Longshortjava.lang.Shortvoidjava.lang.Void(b) Autoboxing is the automatic conversion between a primitive value and acorresponding wrapper object. Write two examples to explain the conceptsof autoboxing and unboxing between int and Integr.1. A snippet from J2SE 5.0 in a Nutshell. ArrayList
2006-06-22 22:12:51 · answer #1 · answered by ? 7 · 0⤊ 0⤋