What is the difference between primitive and non-primitive data types in Java?

Primitive and non-primitive data types are the two main categories of data types in Java. Primitive data types store simple values directly, while non-primitive data types store references to objects and can contain both data and behavior.

Key Points

Example

int age = 25; // Primitive Data Type

String name = "Amol"; // Non-Primitive Data Type

Quick Comparison

Primitive Data Types

Non-Primitive Data Types

Interview Tip

A concise interview answer is

Primitive data types store simple values directly and are predefined by Java, such as int, char, and boolean. Non-primitive data types store references to objects, support methods and OOP features, and include types such as String, arrays, and user-defined classes.

Last updated: 11 November 2026

Previous question: Can JVM execute our overloaded main method?

Next question: Can primitive data types be null in Java?

More Core Java - Level II interview questions

All Core Java - Level II questions