Updates
  • Starting New Weekday Batch for Java Full Stack Developer on 24th June 2024 @ 02:00 PM to 04:00 PM
  • Starting New Weekend Batch for Java Full Stack Developer on 06th July 2024 @ 11:00 AM to 02:00 PM
  • Starting New Weekday Batch for Java Full Stack Developer on 08th July 2024 @ 04:00 PM to 06:00 PM
  • Starting New Weekday Batch for Java Full Stack Developer on 29th July 2024 @ 10:00 AM to 12:00 PM
Join Course

Wrapper Class

In Java, we have 8 primitive data types, such as byte, short, long, which we use to declare variables of different types to hold corresponding values based on the business logic.
However, there are instances when we need to represent primitive type values as objects. This is where the concept of Wrapper classes comes into play.
Wrapper classes are essentially used to encapsulate primitive types as objects.

Use of Wrapper Class:

1. Wrapper classes provide various utility methods.
2. In the Collection Framework, which includes data structures like ArrayList, Vector, HashSet, etc., we work with objects. Wrapper classes allow us to work with primitive types in the Collection Framework.
3. Wrapper classes enable the application of cloning, serialization, and synchronization implementations.

Primitive Data Type Wrapper Class
byte java.lang.Byte
short java.lang.Short
int java.lang.Integer
long java.lang.Long
float java.lang.Float
double java.lang.Double
boolean java.lang.Boolean
char java.lang.Character