The following program is supposed to reverse the elements in the scientists array. It compiles and runs,

Question:

  1. The following program is supposed to reverse the elements in the scientists array. It compiles and runs, but it doesn’t work properly.

import java.util.Arrays; public class Reverse { public static void main(String[] args) { String[] scientists

public static void reverse(String[] list) { String[] temp = Arrays.copyOf(list, list.length); for (int i-0; i

The reversal does not occur. Fix the problem by rewriting the reverse method. Hint: You’ll need to modify one line of code. Although not required, to reduce clutter, you should remove another line of code.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: