Skip to content
Sharp

Modern Java · interview question

Which feature of the Java BigDecimal class makes it suitable for handling monetary values?

Multiple choiceMediumchapter-7-curatedpremiummodern-javacleaner-domain-modeling
Choose one answer
Answer and explanation

Correct answer

A. It provides immutable objects with arbitrary precision.

Why

BigDecimal is suitable for monetary values because it provides immutable objects with arbitrary precision, avoiding the precision issues associated with floating-point arithmetic. This ensures precise calculations for financial applications.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →