Skip to content
Sharp

Core Java · interview question

Which of the following statements will declare a variable to store a product quantity?

Multiple choiceEasychapter-1-curatedpremiumcore-javanumeric-types-and-money-basics
Choose one answer
Answer and explanation

Correct answer

B. Int quantity = 100;

Why

The int type is suited for whole numbers like product quantities, making 'int quantity = 100;' the correct choice.

Test yourself on Core Java

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

Start free test
All Core Java questions →