Question: Given the change() method below: public static void change(char[] array, int index1, int index2) { char temp = array[index2]; array[index1] = array[index2]; array[index2] = temp;

Given the change() method below:

public static void change(char[] array, int index1, int index2) {

char temp = array[index2];

array[index1] = array[index2];

array[index2] = temp;

}

What would be the contents of array after executing the following code segment?

char[] array = {'H', 'K', 'U', 'S', 'T'};

change(array, 1, 3);

Step by Step Solution

3.54 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

After executing the change method with the given array ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Operating System Questions!