Can primitive data types be null in Java?

No, primitive data types in Java cannot hold a null value. Primitive variables store actual values directly and must always contain a valid value of their respective type.

Key Points

Example

int age = 0; // Valid

Integer salary = null; // Valid

public class Demo {
    int number; // Default value is 0

    public static void main(String[] args) {

        // int value = null; // Compilation Error
        Integer value = null; // Valid
    }
}

Common Mistakes

Follow-up Questions

Interview Tip

A concise interview answer is

No, primitive data types cannot be null because they store actual values rather than object references. If a null value is required, wrapper classes such as Integer, Long, or Boolean should be used instead.

Quick Comparison

Primitive Type

Wrapper Class

Last updated: 11 November 2026

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

Next question: Can we declare pointers in Java?

More Core Java - Level II interview questions

All Core Java - Level II questions