What are primitive type wrappers classes? Explain the purpose of primitive type wrapper classes Primitive type wrapper classes or simply wrapper classes are available in java.lang package for providing object methods for all the eight primitive types. All the wrapper class objects are immutable.
A primitive type data element can have the advantages of an object by converting it into its corresponding wrapper class object. The wrapper classes are extensively used along with the Collection framework. Thus it enhances the application’s performance further.
Java 5.0 has additional wrapper classes known as atomic wrapper classes. They are available in java.util.concurrent.atomic package. These classes are mutable. These can not be utilized as a replacement for the wrapper classes. They provide atomic operations for addition, increment and assignment. The atomic wrapper classes are AtomicInteger, AtomicLong, AtomicBoolean, AtomicReference<v>.
|