The following program swaps two elements in an array. But it does not seem to run, but I am sure that I am not doing anything wrong.
public class swap {
public static String[] swap(int first, int second, String[] A) {
String hold = A[first];
A[first] = A[second];
A[second] = hold;
return A;
}
public static void main(String[] args) {
String[] B = {"Dawn", "Justice", "Of"};
String[] c = swap.swap(1, 2, B);
System.out.print(c);
}
}