Skip to content
Sharp

Core Java · interview question

Which of the following statements correctly creates a BigDecimal that represents the monetary value 19.99?

Multiple choiceHardchapter-7-curatedpremiumcore-javabigdecimal-and-money
Choose one answer
Answer and explanation

Correct answer

C. New BigDecimal("19.99")

Why

Using a String constructor like new BigDecimal("19.99") avoids precision issues that can arise when using floating-point literals like 19.99. This ensures the exact value is represented.

Test yourself on Core Java

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

Start free test
All Core Java questions →