Skip to content
Sharp

Modern Java · interview question

Which Java type is commonly used in value objects to represent currency values and ensure precision?

Multiple choiceEasychapter-7-curatedpremiummodern-javavalue-objects
Choose one answer
Answer and explanation

Correct answer

C. BigDecimal

Why

BigDecimal is the preferred type for representing currency values in Java because it provides precise control over decimal arithmetic, avoiding the pitfalls of floating-point precision errors.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →