Skip to content

Instantly share code, notes, and snippets.

@mrnirva
Last active September 3, 2020 18:13
Show Gist options
  • Save mrnirva/fac0005c6816ce3ddd3169448cb0c0f1 to your computer and use it in GitHub Desktop.
Save mrnirva/fac0005c6816ce3ddd3169448cb0c0f1 to your computer and use it in GitHub Desktop.
package arrayssinifi;
public class ArraysSinifi {
public static void main(String[] args) {
int[][] dizim = new int[2][3];
// İlk köşeli parantezin içi satır
// İkinci köşeli parantezin içi sütun
// Böylece kapasiyeyi belirliyoruz
dizim[0][0] = 1;
dizim[0][1] = 2;
dizim[0][2] = 3;
dizim[1][0] = 4;
dizim[1][1] = 5;
dizim[1][2] = 6;
// Diziyi bir tablo halinde yazdırmak
// Çok boyutlu olduğu için iki for kullanmak zorundayız
for(int i=0; i<dizim.length; i++){
for(int j=0; j<dizim[i].length; j++){
System.out.print(""+ dizim[i][j]);
}
System.out.println("");
}
/*
Çıktı:
123
456
*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment