Question: Given the following code, what is printed? private static void initialSwap (int[] arr) { int x = 0; 1 for (int i= 0; i
Given the following code, what is printed? private static void initialSwap (int[] arr) { int x = 0; 1 for (int i= 0; i < arr.length; i++) if (arr[x]> arr[i]) x = i; } int tmp = arr[x]; arr[x] = arr[0]; arr [0]= tmp; System.out.println (arr [0]); public static void main(String[] args) ( int[] arr= (-6, 9, 2, 0, 1, 5); initialSwap (arr); Type your answer...
Step by Step Solution
There are 3 Steps involved in it
private static void initialSwapint arr int x 0 for int i 0 i ar... View full answer
Get step-by-step solutions from verified subject matter experts
