The following program is supposed to reverse the order of the elements in the simpsons array. It compiles and runs, but it doesn’t work properly.
public class Reverse{public static void main(String[] args){String[] simpsons = {"Homer", "Flanders", "Apu"};reverse(simpsons);System.out.println(simpsons[0] + " " + simpsons[1] + " " + simpsons[2]);} // end mainpublic static void reverse(String[] list){String[] temp = new String[list.length];for (int i=0; ia) What does the program print?
b) Fix the program by providing one or more lines of alternative code for the list = temp; line. You are not allowed to change any other code, just provide alternative code for that one line.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.