A

Admin • 830.42K Points
Coach

Q. What will be the output of the following Java code snippet?
double a = 0.02;
double b = 0.03;
double c = b - a;
System.out.println(c);

BigDecimal _a = new BigDecimal("0.02");
BigDecimal _b = new BigDecimal("0.03");
BigDecimal _c = b.subtract(_a);
System.out.println(_c);

  • (A) 0.009999999999999998 0.01
  • (B) 0.01 0.009999999999999998
  • (C) 0.01 0.01
  • (D) 0.009999999999999998 0.009999999999999998
  • Correct Answer - Option(A)
  • Views: 15
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.