Using the Math Class

AP Computer Science A· difficulty 2/5

int m = Math.max(-4, -9);
System.out.println(m);

What is printed?

  • A

    9

  • B

    -4

    check_circle
  • C

    -9

  • D

    4

Explanation

Math.max returns the greater of its arguments; -4 > -9, so the result is -4.

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

Related questions