Jun 6, 2018 in Java 1,011 views

## 2 answers to this question.

You can declare multi dimensional arrays like :

```// 4 x 5 String arrays, all Strings are null
// [0] -> [null,null,null,null,null]
// [1] -> [null,null,null,null,null]
// [2] -> [null,null,null,null,null]
// [3] -> [null,null,null,null,null]

String[][] sa1 = new String[4][5];
for(int i = 0; i < sa1.length; i++) {           // sa1.length == 4
for (int j = 0; j < sa1[i].length; j++) {     //sa1[i].length == 5
sa1[i][j] = "new String value";
}
}

// 5 x 0  All String arrays are null
// [null]
// [null]
// [null]
// [null]
// [null]
String[][] sa2 = new String[5][];
for(int i = 0; i < sa2.length; i++) {
String[] anon = new String[ /* your number here */];
// or String[] anon = new String[]{"I'm", "a", "new", "array"};
sa2[i] = anon;
}

// [0] -> ["I'm","in","the", "0th", "array"]
// [1] -> ["I'm", "in", "another"]
String[][] sa3 = new String[][]{ {"I'm","in","the", "0th", "array"},{"I'm", "in", "another"}};
Custom dissertation writing service is the better service that provides detailed and effective information related to educational basis.
```
• 140 points

a multidimensional array can define an array of an array, the data that store in multidimensional is in tabular form like in a row form, the syntax of initialise the multidimensional array is :

data_type[1st dimension][2nd dimension][]..[Nth dimension] array_name = new data_type[size1][size2]….[sizeN];

where:

• data_type: Type of data to be stored in the array. For example int, char, etc.
• dimension: The dimension of the array created.
For example: 1D, 2D, etc.
• array_name: Name of the array like cheapest essays
• size1, size2, …, sizeN: Sizes of the dimensions respectively.
answered Mar 18, 2019 by monica jesvina

+1 vote

## What is the syntax to declare and initialize an array in java?

You can use this method: String[] strs = ...READ MORE

## How to create a 2-D array in java?

int[][] multi = new int[5][]; multi[0] = new ...READ MORE

## How to print java array in the simplest way?

String[] arr = new String[] {"John", "Mary", ...READ MORE

## How to sort an array in java?

import java.util.Arrays; public class Sort { ...READ MORE

## How can I add new elements to an Array in Java

String[] source = new String[] { "a", ...READ MORE

## How to convert array into list in Java?

Another workaround if you use apache commons-lang: int[] ...READ MORE

## How a static map can be initialized?

public class Test { ...READ MORE

## How to initialize multi-dimensional array in java?

A multidimensional array in Java is really an array ...READ MORE