Grokking Java Interview Questions
Vote

0% completed

​

Dates, Time, and BigDecimal

Three calculations in an online store give unexpected numbers. A delivery is moved by one day, and only 23 hours pass. Ten items at 0.10 have a total of 0.9999999999999999. A price of 1.15 is converted to cents, and the result is 114.

None of these is an error in Java. The first number comes from a clock change, and the other two come from the binary format of double. Two sections below explain the date and time classes, and two explain exact arithmetic with money.

Which java.time types should you use for what?

Level: Junior

**Use Instant for a moment, `LocalDate

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content