Selasa, 09 November 2010

java 2d

/**
* Write a description of class Array2D_cara2 here.
*
* @author (Muhammad Amir)
* @version (04082010)
*/
public class Array2D_cara2
{
public static void main(String[]args){
int[][]arrx={{10,20,30},{40,50,60},{70,80,90}};
//cara dua(2) Array 2 Dimensi
//Dimensi ukuran 3*3
System.out.println(“Nilai arrx[0]:”+ arrx[0][0]);
System.out.println(“Nilai arrx[0]:”+ arrx[0][1]);
System.out.println(“Nilai arrx[0]:”+ arrx[0][2]);
System.out.println(“Nilai arrx[1]:”+ arrx[1][0]);
System.out.println(“Nilai arrx[1]:”+ arrx[1][1]);
System.out.println(“Nilai arrx[1]:”+ arrx[1][2]);
System.out.println(“Nilai arrx[2]:”+ arrx[2][0]);
System.out.println(“Nilai arrx[2]:”+ arrx[2][1]);
System.out.println(“Nilai arrx[2]:”+ arrx[2][2]);
}
}
Hasil Outputnya :
Nilai arrx[0]:10
Nilai arrx[0]:20
Nilai arrx[0]:30
Nilai arrx[1]:40
Nilai arrx[1]:50
Nilai arrx[1]:60
Nilai arrx[2]:70
Nilai arrx[2]:80
Nilai arrx[2]:90

Tidak ada komentar:

Posting Komentar