vendredi 4 septembre 2015

How to loop over two dimensional array in Java?

You can loop over a two-dimensional array in Java by using two for loops, also known as nested loop. Similarly to loop an n-dimensional array you need n loops nested into each other. Though it's not common to see an array of more than 3 dimension and 2D arrays is what you will see most of the places. It's one of the most useful data structure in the programming world. You can use a two-dimensional array to make finite state machine (FSM) solve state based problems, you can use a 2D array to create board games like Chess, Sudoku and Tic-Tac-To and you can even use a two-dimensional array to create 2D arcade games e.g. Tetris, Super Mario Bros and so on. Whatever you see on your screen is nothing but a 2D array which is populated using tiles.
Read more »
Share:

0 commentaires:

Enregistrer un commentaire