I want a dynamic matrix, number rows and columns unkonw, filling it by clicking on a button. Bu there is more: I don\'t want to add entire rows, but just one cell at the time, o
Use this:
List<List<Integer>> dynamicMatrix = new ArrayList<List<Integer>>();
dynamicMatrix.add(new ArrayList<Integer>());
dynamicMatrix.add(new ArrayList<Integer>());
dynamicMatrix.add(new ArrayList<Integer>());
dynamicMatrix.get(0).add(6);
dynamicMatrix.get(0).add(7);
dynamicMatrix.get(0).add(8);
System.out.println(dynamicMatrix.get(0).get(0)); // 6
System.out.println(dynamicMatrix.get(0).get(1)); // 7
System.out.println(dynamicMatrix.get(0).get(2)); // 8