import java.util.ArrayList;
import java.util.List;
public class Program {
public static void PrintMatrix(List<List<Integer>> matrix) {
for (List<Integer> list1d : matrix) {
for (int val : list1d) {
System.out.print(val + " ");
}
System.out.println();
}
}
public static void main(String[] args) {
List<List<Integer>> matrix = new ArrayList<>();
matrix.add(new ArrayList<>(List.of(1, 2, 3, 1, 4)));
matrix.add(new ArrayList<>(List.of(2, 7, 8, 3, 3)));
matrix.add(new ArrayList<>(List.of(3, 6, 9, 1, 5)));
matrix.add(new ArrayList<>(List.of(1, 2, 3, 4, 8)));
PrintMatrix(matrix);
}
}
/*
run:
1 2 3 1 4
2 7 8 3 3
3 6 9 1 5
1 2 3 4 8
*/