0Pricing
Java Academy · Lesson

Primitive vs Wrapper Types

Integer, Double, Boolean and friends.

Two Worlds of Values

Java has primitive types like int, double, and boolean that hold raw values directly. It also has wrapper classes like Integer, Double, and Boolean that wrap those values inside objects.

Primitives are fast and lightweight. Wrappers are full objects that can live in collections and can be null.

The Eight Primitives

Java defines exactly eight primitive types:

  • byte, short, int, long for integers
  • float, double for decimals
  • char for a single character
  • boolean for true/false

Each has a matching wrapper class in the java.lang package.

All lessons in this course

  1. Primitive vs Wrapper Types
  2. Autoboxing and Unboxing
  3. Parsing and Valueof
  4. Autoboxing Pitfalls
← Back to Java Academy