juniorJava

What are Java data types?

Updated May 6, 2026

Short answer

Java has primitive and non-primitive data types.

Deep explanation

Primitive types include int, float, char, boolean. Non-primitive include String, arrays, classes. They define memory allocation and behavior.

Real-world example

Used in storing user data like age, name, salary.

Common mistakes

  • Confusing primitive and object types.

Follow-up questions

  • What is default value of int?
  • Is String primitive?

More Java interview questions

View all →