In Java Suppose you want to implement a Sudoku game that con
In Java: Suppose you want to implement a Sudoku game that consists of 9x9 rows and columns of squares. Which layout would be the best one to use and why? 2D Array or Grid Layout? If its a grid layout why would it be better to use?
Solution
In java, for to implement a Sudoku game that consists of 9x9 rows and columns of squares , GRID LAYOUT would be the best one to use because in sudoku ,the positioning of squares are very important and all squares should be of equal size which is provided by the GRID LAYOUT whereas in case of FLOW LAYOUT ,the positioning can\'t be guaranteed .If the box size increases then the extra box in that row is shifted to the next row which is not suitable for sudoku game
 
 Comparing 2D array or GRID layout - GRID LAYOUT prevails because the programmer don\'t need to specifice the absolute co-ordinates for the elements instead the relative position are required so that the layout will calculate the absolute co-ordinates and it will be easy for the programmer to design.And , even when we resize we don\'t need to calculate everything .As,relative positions are already provided ,the layout will automatically calculate and place the elements accordingly which is not the case in 2d array

