Skip to content
Sharp

Core Java · interview question

Why might using a primitive type be preferable in performance-critical Java code?

Multiple choiceEasychapter-7-curatedpremiumcore-javawrapper-types-and-autoboxing
Choose one answer
Answer and explanation

Correct answer

B. Avoids the overhead of object creation

Why

Primitive types do not incur the overhead of object creation, making them more efficient in terms of memory and performance, especially in performance-critical code.

Test yourself on Core Java

A free test with instant, explained results. No account needed.

Start free test
All Core Java questions →