Wrapper Classes: Integer and Double

AP Computer Science A· difficulty 3/5

String s = "3.14";
double d = Double.parseDouble(s);
System.out.println(d * 2);

What is printed?

  • A

    6.28

    check_circle
  • B

    Error

  • C

    6

  • D

    3.14

Explanation

Double.parseDouble converts the string "3.14" to the double value 3.14; multiplied by 2 the result is 6.28.

Want 10 more like this — adaptive to your weak spots?

Related questions