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
After executing the change method with the given array ... View full answer
Get step-by-step solutions from verified subject matter experts
