Skip to main content

What are primitive and reference data types?

Entry Java
Quick Answer Primitive types (int, double, boolean, char, byte, short, long, float) store values directly in memory - fast, no object overhead. Reference types (String, arrays, objects) store a reference (memory address) to an object on the heap. Primitives can't be null; reference types can. Primitives are passed by value; object references are also passed by value (the reference, not the object).

Answer

Primitive: Stores actual value (int, boolean, etc.).
Reference: Stores memory address of objects (arrays, strings, objects).
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice