Skip to content
Sharp

Core Java · interview question

Why might you choose 'int' over 'long' for storing the number of items in a small store's inventory?

Multiple choiceMediumchapter-1-curatedpremiumcore-javavariables-and-data-types
Choose one answer
Answer and explanation

Correct answer

B. Less memory usage

Why

'int' uses less memory than 'long', which can be beneficial for small-scale applications where the range of 'int' is sufficient. This makes it more efficient in terms of memory usage.

Test yourself on Core Java

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

Start free test
All Core Java questions →