Skip to content
Sharp

Core Java · interview question

Which of the following is a valid declaration for a product's stock quantity in Java?

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

Correct answer

A. Int stockQuantity;

Why

In Java, a variable is declared by specifying the data type followed by the variable name. 'int stockQuantity;' is the correct syntax for declaring an integer variable.

Test yourself on Core Java

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

Start free test
All Core Java questions →