Tuesday, 1 October 2013

what will be the return statement?

what will be the return statement?

question- construct a method called swapElements(). It takes an array of
integers, and two integer indexes. The method should swap the values of
the array elements with the specified indexes.
public class{
int swapElements(int[] number, int value1, int value2){
int temp = number[value1];
number[value1] = number[value2];
number[value2] = temp;
}
}

No comments:

Post a Comment