Outputting 3 dimensional array

Viewed 25

Can someone help me with how I can output this 3d array into this format the image below shows the format, I try to solve it on my own but I can't find the solution then I'm still new in programming please help and I'm sorry if my English is not well and not very understandable. Thank you in advance.

import java.util.*;

public class lbArrayActOne_Madelo {

    public static void main(String[] args) {

        String dimension3 [][][] = {{ // index 0 table
                                    {"1a", "2b", "3c", "4d"}, //r1
                                    {"5e", "6f", "7g", "8h"}  //r2
                                    },
                                    {//index 1 table
                                        {"22z", "25y", "23x"}, //r1
                                        {"23w", "22v", "21u"} //r2
                                    }
                                };


                                for (int i = 0; i < 2 ; i++)
                                        for (int j = 0; j < 2; j++) 
                                            for (int k = 0; k < 3; k++) 

                                System.out.print(dimension3[i][j][k] + " ");   
                                                                           

    }

}

enter image description here

0 Answers
Related