What Will Be The Output Of The Following Java Code Snippetp Pre #33
What will be the output of the following Java code snippet?</p> <pre><code class="language-java" line="1"> 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); </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs128 Java. It can also be found in gs gs128 Java Data Types Variables Arrays - Java BigDecimal - Quiz No.1.
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);
0.009999999999999998 0.01
0.01 0.009999999999999998
0.01 0.01
0.009999999999999998 0.009999999999999998