I call my swap method in main, but it doesn\'t change anything. What am I doing wrong?
public static void main(String[] args){ int mainArr[] = new int[
Writing the code as so:
int mainArr[] = new int[20]; for(int i =0; i
will resolve the issue. The problem was you happened to be calling swap an even number of times, so it had a total effect of nothing.