I misunderstand something in this for loop. Can someone please clarify?
String[][] artikelTabelle;
artikelTabelle = new String[2][2];
artikelTabelle[0][0] = "Cow";
artikelTabelle[0][1] = "Sheep";
artikelTabelle[1][0] = "Dog";
artikelTabelle[1][1] = "Lion";
for(int i = 0; i < artikelTabelle.length; i++){
for(int j = 0; j < artikelTabelle[0].length; j++){
System.out.println(artikelTabelle[i][j]);
}
}
At first i and j are 0. Consequently, the array [0][0] (Cow) is printed. But during the second iteration, aren't i and j both 1, because of i++ and j++? Meaning that Lion should be printed? What do I misunderstand here? And since artikelTabelle[0].length has the length 2 - why would it be false to replace it with the number 2?
iis incremented.