//******************************************************************** // TwoDArray.java Author: Lewis and Loftus // // Uso di array bi-dimensionale. //******************************************************************** public class TwoDArray { //----------------------------------------------------------------- // Crea un array di interi a 2 dimensioni (5 righe di 10 colonne), // lo riempie con interi di valore crescente e lo stampa. //----------------------------------------------------------------- public static void main (String[] args) { int[][] table = new int[5][10]; // Carica la tavola con i valori for (int row=0; row < table.length; row++) for (int col=0; col < table[row].length; col++) table[row][col] = row * 10 + col; // Stampa la tavola for (int row=0; row < table.length; row++) { for (int col=0; col < table[row].length; col++) System.out.print (table[row][col] + "\t"); System.out.println(); } } }