subject

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

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:10
Write a method that accepts a string object as an argument and returns the number of words it contains. for instance, if the argument is "four score and seven years ago", the method should return the number 6. demonstrate the method in a program that asks the user to input a string and then passes that string into the method, printing out whatever the method returns.
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
What is outfitting a workplace with video in a technology
Answers: 2
question
Computers and Technology, 23.06.2019 07:00
You need a quick answer from a coworker. the most effective way to reach your coworker is through a. cloud server b. instant message c. teleconference d. telepresence
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
How often does colleges update the cost of attendance on their website? . a)every two years b) every four years c) every year d) every semester
Answers: 1
You know the right answer?
Do the following two programs produce the same result?
Program I:
public class Test {
Questions
question
Mathematics, 19.06.2021 08:20
question
Mathematics, 19.06.2021 08:20
question
Mathematics, 19.06.2021 08:30
question
Mathematics, 19.06.2021 08:30
question
Biology, 19.06.2021 08:30
Questions on the website: 13722362