When I run this
public static void main(String[] args) {
selectionSort(new Integer[] { 1, 0, 4, 2 });
}
I get the output
Selection Sort Comparisons: 6
Selection Sort Assignments: 2
0, 1, 2, 4,
Are you possibly expecting a static
or other local variable also called assignmentCounter
to be changed?
The variable assignmentCounter
declared in selectionSort
is local to that method. Nothing outside of it can see it.