Using the Math Class

AP Computer Science A· difficulty 3/5

int n = (int) Math.pow(3, 4);
System.out.println(n);

What is printed?

  • A

    81

    check_circle
  • B

    12

  • C

    81.0

  • D

    27

Explanation

Math.pow(3, 4) returns 81.0; casting to int gives 81.

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

Related questions