Skip to content
Sharp

Core Java · interview question

When dealing with currency in Java, why is it crucial to use BigDecimal instead of float or double?

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

Correct answer

B. BigDecimal provides arbitrary precision.

Why

BigDecimal provides arbitrary precision which is essential for accurate financial calculations. Floating-point types can introduce rounding errors that are unacceptable in monetary contexts.

Test yourself on Core Java

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

Start free test
All Core Java questions →