Question: Java ,,,, no idea why my code is not working Write a method swapArrayEnds() that swaps the first and last elements of its array parameter.
Write a method swapArrayEnds() that swaps the first and last elements of its array parameter. Ex: sortArray = {10,20,30,40) becomes (40,20,30, 10) 4 1 import java.util.Scanner 2 3. public class ModifyArray ( 5 public statie voia swapArrayEnds (int[] sortArray, Int numelen) 6 int tep-SortArray(); 7 sortArray[0] - sortArray[nun Elen-1]; 8 SortArray[numElem-1] - tep 9 10 11 public static void main(String [] args) { 12 Scanner schr - new Scanner(System.in); int nuntlem - 4; 14 1 sortArray new int[nuntleni 15 int si 16 int userfium; 17 10 for (i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
