2024-09-02 01:41:23
Scanner sc = new Scanner(System.in);
// 接受m和n的值
int m = sc.nextInt();
int n = sc.nextInt();
String[][] arr = new String[m][n];
// 为二维数组赋值
for (int i=0;i<m;i++)
for (int j=0;j<n;j++){
arr[i][j] = sc.next();
}
// 输出二维数组
for (int i=0;i<m;i++){
for (int j=0;j<n;j++)
System.out.print(arr[i][j] + ",");
System.out.println();
}