Write the line that declares a twodimensional array of strin
Write the line that declares a two-dimensional array of strings named chessboard. That is, how would I declare a two-dimension array of strings that is called chessboard? You would declare a String array by saying \" String []\" correct? Now that\'s just a single array. How can I make that a two-dimension array? And how would I name it chessboard?
Write the line that declare and creates a two-dimensional array of chars, tictactoe, with 3 rows, each with 3 elements , and initialize it to all space characters.
Write the line that declares and instantiates a 8x8 two-dimensional array of strings named chessboard.
A 2-dimensional 3x3 array of ints , has been created and assigned to tictactoe. Write an expression whose value is that of the first element in the last row (See topic 8.2, page 289 - this solution could be of simply one line.)
Solution
Declare a two-dimensional array of strings named chessboard.
String [][] chessboard;
Write a statement that instantiates an 8x8 array of strings and assign it to chessboard.
chessboard = new String[8][8];
Declare and create a two-dimensional array of chars, tictactoe, with 3 rows, each with 3 elements, and initialize it to all space characters.
char[][] tictactoe = {{\' \',\' \',\' \'},{\' \',\' \',\' \'},{\' \',\' \',\' \'}}
A 2-dimensional 3x3 array of ints, has been created and assigned to tictactoe. Write an expression whose value is that of the first element in the last row.
tictactoe[2][0]
