Skip to content
Sharp

Core Java · interview question

Which of the following is a valid way to declare a double representing a product price?

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

Correct answer

C. Double price = 29.99;

Why

The double type is suitable for representing decimal values, such as a product price. It allows you to store floating-point numbers.

Test yourself on Core Java

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

Start free test
All Core Java questions →