Tugas Pemograman 2 ( Array Multi Dimensi)


/**
* ArrayMultiD
*
* @author (hasanmualim)
* @versi (04072010)
*/
public class ArrayMultiD
{
public static void main(String[]args){
int[][][]arr3={{{10,20,30},{40,50,60}},{{11,21,31},{41,51,61}},
{{12,22,32},{42,52,62}}};
//Dimensi ukuran 3*6=18
System.out.println(“Nilai arr3[0]:”+arr3[0][0][0]);
System.out.println(“Nilai arr3[0]:”+arr3[0][0][1]);
System.out.println(“Nilai arr3[0]:”+arr3[0][0][2]);
System.out.println(“Nilai arr3[0]:”+arr3[0][1][0]);
System.out.println(“Nilai arr3[0]:”+arr3[0][1][1]);
System.out.println(“Nilai arr3[0]:”+arr3[0][1][2]);
System.out.println(“Nilai arr3[1]:”+arr3[1][0][0]);
System.out.println(“Nilai arr3[1]:”+arr3[1][0][1]);
System.out.println(“Nilai arr3[1]:”+arr3[1][0][2]);
System.out.println(“Nilai arr3[1]:”+arr3[1][1][0]);
System.out.println(“Nilai arr3[1]:”+arr3[1][1][1]);
System.out.println(“Nilai arr3[1]:”+arr3[1][1][2]);
System.out.println(“Nilai arr3[2]:”+arr3[2][0][0]);
System.out.println(“Nilai arr3[2]:”+arr3[2][0][1]);
System.out.println(“Nilai arr3[2]:”+arr3[2][0][2]);
System.out.println(“Nilai arr3[2]:”+arr3[2][1][0]);
System.out.println(“Nilai arr3[2]:”+arr3[2][1][1]);
System.out.println(“Nilai arr3[2]:”+arr3[2][1][2]);
}
}

Hasil Outputnya

Nilai arr3[0]:10

Nilai arr3[0]:20

Nilai arr3[0]:30

Nilai arr3[0]:40

Nilai arr3[0]:50

Nilai arr3[0]:60

Nilai arr3[1]:11

Nilai arr3[1]:21

Nilai arr3[1]:31

Nilai arr3[1]:41

Nilai arr3[1]:51

Nilai arr3[1]:61

Nilai arr3[2]:12

Nilai arr3[2]:22

Nilai arr3[2]:32

Nilai arr3[2]:42

Nilai arr3[2]:52

Nilai arr3[2]:62

Tentang hasanmualim

Wong Ndeso
Pos ini dipublikasikan di Tak Berkategori. Tandai permalink.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s