DOUBT IN SWAP

Ma’am I’ve directly done swap like this. What’s the use of SwapFunction then?

//SWAPPING AN ARRAY
public class SwapFunctionArray {
public static void main(String[] args) {
int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
int i = array[3];
int j = array[8];
System.out.println(“:point_down::point_down:Without swapping​:point_down::point_down:”);
System.out.println(i + “,” + j);
int a = i;
i = j;
j = a;
System.out.println(“:point_down::point_down:After swapping​:point_down::point_down:”);
System.out.println(i + “,” + j);
}
}

@discobot if you swapped like this then you don’t need swapping function.

Hi! To find out what I can do, say @discobot display help.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.