# Thread: 4 dimensional array decleration

1. Member
Join Date
Nov 2013
Posts
24
Rep Power
0

## 4 dimensional array decleration

Hello everybody..

My name is John and I have decided to learn java.

I am fiddling around a bit with it and I want to make declare a 4dimensional int array where EACH array containing 20 cells.

I have this:
Java Code:
`int[][][][] vierdeDimensie = new int[20][20][20][20];`
Is this correct?

2. ## Re: 4 dimensional array decleration

Yep, it' fine; do realize that the array contains 20*20*20*20 elements (160000).

kind regards,

Jos

3. Member
Join Date
Nov 2013
Posts
24
Rep Power
0

## Re: 4 dimensional array decleration

Originally Posted by JosAH
Yep, it' fine; do realize that the array contains 20*20*20*20 elements (160000).

kind regards,

Jos
Thank you very much.

This is a practice exercise I am doing and the exercise literally says:
Declare a 4dimensional int array where EACH array containing 20 cells.

4. ## Re: 4 dimensional array decleration

Originally Posted by bodylojohn
Thank you very much.

This is a practice exercise I am doing and the exercise literally says:
Declare a 4dimensional int array where EACH array containing 20 cells.
If that's what the exercise says ... you have memory enough for that 4D matrix (160000 elements times 4 bytes per element makes 640000 bytes of memory; we wouldn't dream of that much memory in the 70s of the previous century ;-)

kind regards,

Jos

5. Member
Join Date
Nov 2013
Posts
24
Rep Power
0

## Re: 4 dimensional array decleration

Originally Posted by JosAH
If that's what the exercise says ... you have memory enough for that 4D matrix (160000 elements times 4 bytes per element makes 640000 bytes of memory; we wouldn't dream of that much memory in the 70s of the previous century ;-)

kind regards,

Jos