Skip to content
Sharp

Core Java · interview question

Why should you be cautious when relying on autoboxing and unboxing in performance-critical code?

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

Correct answer

C. It can introduce hidden performance costs

Why

Autoboxing and unboxing introduce overhead because of the conversions between primitives and their wrapper classes, which can impact performance in tight loops or performance-critical sections of code.

Test yourself on Core Java

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

Start free test
All Core Java questions →