Show the output of the following code:
```
public class Test {
public static void main(String[] args) {
int[] x = {1, 2, 3, 4, 5};
increase(x);
int[] y = {1, 2, 3, 4, 5};
increase(y[0]);
System.out.println(x[0] + " " + y[0]);
}
public static void increase(int[] x) {
for (int i = 0; i < x.length; i++)
x[i]++;
}
public static void increase(int y) {
y++;
}
}```
a. 0 0
b. 1 1
c. 2 2
d. 2 1
e. 1 2
d Invoking increase(x) passes the reference of the array to the method. Invoking increase(y[0]) passes the value 1 to the method. The value y[0] outside the method is not changed.
You might also like to view...
An IP address is composed of two parts, one is the ____________ ID and one is the host ID.
Fill in the blank(s) with the appropriate word(s).
If button1 is a JButton object, which of the following statements will make its background blue?
A) button1.makeBackground(BLUE); B) button1.setBackground(Color.BLUE); C) button1.makeBackground(Color.BLUE); D) button1.set.Background(BLUE);