Below is my code. Here, i have to switch two of the names in the 2D array but i'm not sure how to do this.
Anyone knows how to do?
import java.util.Scanner;
public class Homeworktest {
public static void main(String[] args) {
String[][] people = new String[3][3];
people[0][0] = "April";
people[0][1] = "Jenny";
people[0][2] = "Charlie";
people[1][0] = "Maya";
people[1][1] = "Daniel";
people[1][2] = "Felix";
people[2][0] = "Jack";
people[2][1] = "Charlotte";
people[2][2] = "Nick";
for(int i = 0; i < people.length; i++) {
String[] subarrays = seatingChart[i];
for(int y = 0; y < people.length; y++) {
System.out.print(subarrays[y] + " ");
}
System.out.println();
}
public static void switchSeats(int row1, int col1, int row2, int col2) {
}
}
}