What are the eight primitive data types in Java?
Why Interviewers Ask This
Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid Java basics — a prerequisite for any developer role.
Answer
Java has eight primitive data types: byte (8-bit integer, -128 to 127), short (16-bit integer), int (32-bit integer, most commonly used), long (64-bit integer, uses L suffix), float (32-bit floating point, uses f suffix), double (64-bit floating point, default for decimals), char (16-bit Unicode character), and boolean (true or false). Primitives store actual values directly in memory (stack), not object references, making them more efficient than their wrapper class counterparts.
Pro Tip
Back up your answer with a specific project or situation. Saying 'In my last Java project, I used this when...' immediately makes your answer more credible and memorable.
Previous
What is the difference between JDK, JRE, and JVM?
Next
What is the difference between int and Integer in Java?