Skip to content
Sharp

Modern Java · interview question

What advantage does using Integer over int provide in Java?

Multiple choiceEasychapter-7-curatedpremiummodern-javamodern-java-design-choices
Choose one answer
Answer and explanation

Correct answer

A. Supports null values

Why

The Integer class allows you to represent null values, which can be useful in scenarios where a value's presence or absence needs to be explicitly managed.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →