Welcome to the Ranch!
First, that exercise sounds like a good example of how NOT to do things in Java.
Next, is this homework or self-study? If it's homework, then don't you have any notes from class? What part of your textbook are you on? That should have information about how to use loops with nested arrays.
Next, Java doesn't have true multidimensional arrays. You can simulate them using nested arrays. That is, arrays whose elements are themselves arrays. Nesting of arrays can be multiple levels deep.
If you are doing self study, then refer to the
Official Java Tutorials.