Answer to Question #137081 in Java | JSP | JSF for Kaone

Question #137081
how to implement two dimensional arrays?
1
Expert's answer
2020-10-06T14:35:14-0400

A two dimensional array is implemented as an array of one dimensional arrays. The Two Dimensional Array is an array of arrays. We use a new operator to create a two dimensional arrays. For example:

Data_Type[][] Array_Name = new int[Row_Size][Column_Size];

Row_size is row elements an array can store. For instance, For example, Row_Size = 6, then the array will have six rows. Column_Size is the column elements an array can store. For example, Column_Size = 7, then the array will have seven columns. The two dimensional arrays can be declared and created in the same line of code. For intance,

int[][] Student_Marks = new int[2][3];

We can also create a two dimensional array and assign the elements to that array without stating the row and column size. For instance,

int[][] Employees = { {10, 20, 30}, {15, 25, 35}, {22, 44, 66}, {33, 55, 77} };

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS