Home / MCQ Bank / Computer
Computer Data Types And Variables Difficulty: Medium

What will be the output of the following Java code snippet? public class AddDemo { public static void main(String args[]) { BigDecimal b = new BigDecimal("23.43"); BigDecimal br = new BigDecimal("24"); BigDecimal bres = b.add(new BigDecimal("450.23")); System.out.println("Add: "+bres); MathContext mc = new MathContext(2, RoundingMode.DOWN); BigDecimal bdecMath = b.add(new BigDecimal("450.23"), mc); System.out.println("Add using MathContext: "+bdecMath); } }

Select the correct option to test your answer:

More Computer Questions

In Java, what does the "break" statement do in a loop? What will be the output of the following C code? char str[] ; strcpy(str, "Hello"); res = atoi(str); printf(" %s %d\n", str, res); . . . . . . . . return a list of hdfs files to ship to distributed cache. In R, which package provides tools for working with graphs and networks? What access modifier allows a class member to be accessed from any class in the same package or any subclass?