Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

BigDecimal

A standard-library class that stores decimal numbers exactly, used for money.

java.math.BigDecimal is an arbitrary-precision decimal number; construct it from a String, not a double, and use methods such as add and multiply.

Examples

  • new BigDecimal("0.10").add(new BigDecimal("0.20")) is exactly 0.30.

See also

Read the full section →