Math Method Chaining
Calculate the final integer output by applying standard Math class methods to a negative integer value.
What is printed when the following Java program is compiled and run?
public class QuestionTrace {
public static void main(String[] args) {
int x = -9;
double y = Math.sqrt(Math.abs(x) + 16);
int z = (int) Math.pow(y, 2);
System.out.println(z - 10);
}
}
A
25
B
35
C
5
D
15
Question Leaderboard
Not enough data yet to show leaderboard.
