Ejemplo 1: matrices bidimensionales de Java
int[][] multiples = new int[4][2]; // 2D integer array with 4 rows
and 2 columns
String[][] cities = new String[3][3]; // 2D String array with 3 rows
and 3 columns
Ejemplo 2: lista de matrices 2d en java
int vertexCount = 3;
ArrayList<ArrayList<Integer>> graph = new ArrayList<>(vertexCount);
//Next, we'll initialize each element of ArrayList with another ArrayList:
for(int i=0; i < vertexCount; i++) {
graph.add(new ArrayList());
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)