fork download
  1. import java.util.*;
  2.  
  3. class Ideone {
  4. public static void main (String[] args) {
  5. List<List<Integer>> matrix = Arrays.asList(Arrays.asList(1, 2), Arrays.asList(3, 4));
  6. matrix = Collections.unmodifiableList(matrix);
  7. matrix.get(1).set(1, 666);
  8. for (List<Integer> row : matrix) {
  9. for (Integer value : row)
  10. System.out.print(value + " ");
  11. System.out.println();
  12. }
  13. }
  14. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
1 2 
3 666