Senin, 25 Mei 2009

Script Array Dua Dimensi Pada Java

public class ArrayDuaD {
public static void main(String[] args) {
final int BARIS = 5;
final int KOLOM = 3;

int[][] num = new int[BARIS][KOLOM];

for(int i = 0; i < BARIS; i++) {
for(int j = 0; j < KOLOM; j++) {
num[i][j] = i * j + (3 * (i - j));
}
}

System.out.println("Isi array:");

for(int i = 0; i < BARIS; i++) {
for(int j = 0; j < KOLOM; j++) {
System.out.print(num[i][j] + " ");
}
System.out.println();
}
}
}



Artikel Yang Bersangkutan



Template by : kendhin x-template.blogspot.com