Page 1 of 1

I'm not sure what I am doing wrong. any help would be much appreciated.

Posted: Tue Jul 12, 2022 8:16 am
by answerhappygod
I'm not sure what I am doing wrong. any help would be muchappreciated.
I M Not Sure What I Am Doing Wrong Any Help Would Be Much Appreciated 1
I M Not Sure What I Am Doing Wrong Any Help Would Be Much Appreciated 1 (57.29 KiB) Viewed 21 times
Write the procedure named SwapEnds (). You'll find the file (Swap Ends.java) in this week's code folder.) Here are the specifications: The SwapEnds () procedure is passed an array of ints named nums. You should swap the first and last elements in the array. Since this is a procedure, you won't have any return value. (The array length will be at least 1.) Here are the Javadoc tags: @param nums an array of int to be modified. • No @return because this is a procedure. Here are some examples: swapEnds ({1, 2, 3, 4}) changes nums to {4, 2, 3, 1} swapEnds ({1, 2, 3}) changes nums to {3, 2, 1} swapEnds ({8, 6, 7, 9, 5}) changes nums to {5, 6, 7, 9, 8} SwapEnds.java 1 public class SwapEnds 2 { 3 public int[] swapEnds (int[] numbers) { 4567890 9 } 10 } int swap = numbers [0]; numbers [0] = numbers [numbers.length - 1]; numbers [numbers. length 1] = temp; return numbers;