Java is not C++.
You need to write swap differently in Java.
public static void swap(int[] a, int i, int j) {
int t = a[i];
a[i] = a[j];
a[j] = t;
}
Java doesn’t support &
and *
unary operators.
On the plus side you don’t need to pass the length of an array
public static void bubble(int[] a) {
for (int i = 0; i < a.length; i++) {
0
solved Why does java throw an error when we use address and pointer for the following sorting program?