Question 8-1

Suppose we were to execute the run() method of the following program. What would it print?

import csbsju.cs160.*;
public class Test {
    public static void f(int x, int[] a) {
        x = 2;
        a[0] = 5;
    }
    public static void run() {
        int y = 3;
        int[] b = { 4 };
        f(y, b);
        IO.println(y + " " + b[0]);
    }
}

Solution

3 5

Back to Review for Quiz 8