Do the following two programs produce the same result?
```
Program I:
public class Test {
public static void main(String[] args) {
int[] list = {1, 2, 3, 4, 5};
reverse(list);
for (int i = 0; i < list.length; i++)
System.out.print(list[i] + " ");
}
public static void reverse(int[] list) {
int[] newList = new int[list.length];
for (int i = 0; i < list.length; i++)
newList[i] = list[list.length - 1 - i];
list = newList;
}
}
Program II:
public class Test {
public static void main(String[] args) {
int[] oldList = {1, 2, 3, 4, 5};
reverse(oldList);
for (int i = 0; i < oldList.length; i++)
System.out.print(oldList[i] + " ");
}
public static void reverse(int[] list) {
int[] newList = new int[list.length];
for (int i = 0; i < list.length; i++)
newList[i] = list[list.length - 1 - i];
list = newList;
}
}
```
a. Yes
b. No
a. Yes
You might also like to view...
An implicit calculated field is created when a formula is typed in the Calculation Area of the Power Pivot window
Indicate whether the statement is true or false
A user reports that printed pages are smearing after the pages come out of a laser printer. Which of the following is the MOST likely problem?
A. The corona wire is not supplying the correct voltage. B. The fuser is not reaching the correct temperature. C. The paper is card stock and is too thick. D. The paper has a humidity content that is too low.