Contoh deklarasi dan inisialisasi array dua dimensi


java is the great

public class Matriks
{
public static void main (String[ ] args)
{
int [ ] [ ] bilangan = {
{1, 5, 2, 9, 7},
{2, 9, 5, 8, 9},
{34, 17, 10, 89, 67},
{14, 71, 24, 92, 10}
};

// Menampilkan nilai array
for (int i = 0; i < 4; i++)
{
for(int j = 0; j < 5; j ++)
System.out.print (bilangan[i][j] + ” “);
System.out.println();
}
}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s