Vidyalelo
Java Programming · Q60

Data Types and Variables

Programming · Java Programming · question 60

Q60

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
Answer
B.
0.01
0.009999999999999998
C.
0.01
0.01
D.
0.009999999999999998
0.009999999999999998

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board