Skip to content
Sharp

Modern Java · interview question

Why should BigDecimal be preferred over double for currency calculations in Java?

Multiple choiceHardchapter-7-curatedpremiummodern-javamodern-java-design-choices
Choose one answer
Answer and explanation

Correct answer

C. BigDecimal provides exact decimal representation

Why

BigDecimal is preferred for currency calculations because it provides exact decimal representation and avoids the precision issues associated with floating-point arithmetic, which is common with doubles.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →