'how to write a 4d array in java using my approach

enter image description here

I am writing a 4d array but the issue is i am unable to write it due to a error i.e error: incompatible types: int cannot be converted to int[][]



Solution 1:[1]

private int[] arrayNormal = {1,2,3,4};

private int[][] array2d = {{1,2,3}, {4,5,6}, {7,8,9}};

private int[][][] array3d = {{{1,2,3},{4,5,6},{7,8,9}},{{10,11,12},{13,14,15},{16,17,18}},{{19,20,21},{22,23,24},{25,26,27}}};

private int[][][][] array4d = take array3d and replace every number with an array of numbers. 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Weber