Multiple choice technology programming languages

What data type should be used for storing precise values ?

  1. float

  2. Float

  3. Double

  4. BigDecimal

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

For storing precise decimal values (especially monetary data), BigDecimal should be used instead of float or Double. Float and Double use binary floating-point which can introduce rounding errors, while BigDecimal uses decimal arithmetic exactly.