Created
September 29, 2019 01:16
-
-
Save sugiartocokrowibowo/0e0d0ae7ebc7729a5f064066be148226 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LatihanArray001{ | |
public static void main(String[]amirul){ | |
//Contoh untuk menyimpan data array 2D yang bertipe integer yang terdiri dari 2 baris 3 kolom: | |
int[ ][ ] dataku = new int[2][3]; | |
dataku[0][0] = 12; | |
dataku[0][1] = 25; | |
dataku[0][2] = 4; | |
dataku[1][0] = 81; | |
dataku[1][1] = 34; | |
dataku[1][2] = 7; | |
//nah, untuk menampilkannya ke console boleh menggunakan looping for bersarang berikut | |
for(int i = 0; i < dataku.length;i++){ | |
for(int j=0; j < dataku[i].length; j++){ | |
System.out.print(dataku[i][j]+" "); | |
} | |
System.out.println( ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment