public class doublePrecision { public static void main(String[] args) { double total = 0; total += 5.6; total += 5.8; System.out
As others have noted, not all decimal values can be represented as binary since decimal is based on powers of 10 and binary is based on powers of two.
If precision matters, use BigDecimal, but if you just want friendly output:
System.out.printf("%.2f\n", total);
Will give you:
11.40