Getting Monetary Amounts Right

Monetary amounts. In the early chapters, for convenience, we use type double to represent monetary amounts. Due to the potential for incorrect monetary calculations with type double, class BigDecimal (which is a bit more complex) should be used to represent monetary amounts. We demonstrate BigDecimal in Chapters 8 and 25.

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.