Page 541 - AP Computer Science A, 7th edition
P. 541

data (weights) to test a program that calculates shipping charges?
(A) 0, 2, 5, 20
(B) 1, 4, 16
(C) −1, 1, 2, 3, 5, 16, 20
(D) −1, 0, 1, 2, 3, 5, 16, 20, 22 (E) All integers from −1 through 22
24. Consider the following instance variable and methods in the same class.
private int[][] matrix;
/∗ ∗ Precondition: array.length > 0.
∗ @return the largest integer in array ∗/
private int max(int[] array)
{ /∗ implementation not shown ∗/ }
/∗∗ @return num1 if num1 >= num2; otherwise return num2
∗/
public int max(int num1, int num2) { /∗ implementation not shown ∗/ }
Suppose matrix has a current value of
2148 6039 5776 1234
What will be returned by the following method call in the same class?
max(max(matrix[2]), max(matrix[3]))

















































































   539   540   541   542   543