Hello fellow programmers!
I will post here the whole code i have. What I am trying to get is a full list of what's inside the array. I figured out how to do it with for loop and .length.
What I am asking here is: Is there any other way to print whole array?
Code starts here:
double[][][] skuskaTroj = new double[][][] {
{
{ 12.44, 525.38, -6.28, 2448.32, 632.04 }, // [0][][]
{ -378.05, 48.14, 634.18, 762.48, 83.02 },
{ 64.92, -7.44, 86.74, -534.60, 386.73 }
},{
{ 48.02, 120.44, 38.62, 526.82, 1704.62 }, // [1][][]
{ 56.85, 105.48, 363.31, 172.62, 128.48 },
{ 906.68, 47.12, -166.07, 4444.26, 408.62 }
},{
{ 27, 263, 37.43, 26874, 5547 }, // [2][][]
{ 53, 978, 264, 338, 25287 },
{ 18765, 222, 363.28, 225.29, 12345 },
}
};
for (int x = 0; x < skuskaTroj.length; x++) {
for (int y = 0; y < skuskaTroj.length; y++) {
for (int z = 0; z < 5; z++) {
System.out.println("Hodnota je: " + skuskaTroj[x][y][z]);
}
}
}
Also, as you can see, in last for loop I used z < 5 because z < skuskaTroj.length didnt worked for me. It did not print the whole list. the 4th and 5th number in each line was skipped. Any idea why?
Thanks ;)