public class ZweidimensionaleMatrix { public static void main(String[] args) { int [] [] matrix; // Deklaration matrix = new int[3][4]; // Erzeugen einer n x m Matrix // Zwei ineinander "verschachtelte" Schleifen // zum Erzeugen der Werte for (int x = 0; x < matrix.length; x++) for (int y = 0; y < matrix[0].length; y++) matrix [x][y] = (int) (Math.random() * 100.0) +1; // Das gleiche wieder, jetzt mit Ausgabe! for (int x = 0; x < matrix.length; x++) { for (int y = 0; y < matrix[0].length; y++) { // NB: "\t" ist ein Tabulator System.out.print(matrix [x][y] + ",\t"); } System.out.println(""); } } }