What are wrapper classes in Java?

Wrapper classes are object representations of Java's primitive data types. They allow primitive values to be used as objects, enabling them to work with collections, generics, and APIs that require objects instead of primitive types.

Key Points

Example

An ArrayList cannot store primitive int values directly, so Integer wrapper objects are used instead.

import java.util.ArrayList;
import java.util.List;

public class Demo {

    public static void main(String[] args) {

        List<Integer> numbers = new ArrayList<>();
        numbers.add(100); // Autoboxing

        int value = numbers.get(0); // Unboxing

        System.out.println(value);
    }
}

Primitive to Wrapper Mapping

Interview Tip

A concise interview answer is

Wrapper classes are object versions of primitive data types. They allow primitives to be used where objects are required, such as in collections and generics. Java provides wrapper classes like Integer, Double, Character, and Boolean, along with automatic autoboxing and unboxing support.

Last updated: 11 November 2026

Previous question: Can we declare pointers in Java?

Next question: Why do we need wrapper classes?

More Core Java - Level II interview questions

All Core Java - Level II questions