//I created this program which creates 3-dimensional array and prints elements of the array
public class ThreeDimensionalArray { public static void main(String[] args) { int[][][] myArray; myArray = { { {11,12,13,14}, {15,16}, {17}, {18,19} }, { {21,22}, {23,24,25}, {26,27,28,29} }; // end of 3-D array //a loop to print the values of a three-dimensional array for(int i=0; i<myArray.length; i++) for(int j=0; j<myArray[i].length; j++) for(int k=0;k<myArray[j]).length;k++) System.out.print(myArray[i][j][k]); } //ends main } // ends class ThreeDimensionalArray
But the program gives me this error when compiling it:
E:\JAVA_STUNTS\Array_Work>javac ThreeDimensionalArray.java
ThreeDimensionalArray.java:11: illegal start of expression
myArray = { { {11,12,13,14},
^
ThreeDimensionalArray.java:11: not a statement
myArray = { { {11,12,13,14},
^
ThreeDimensionalArray.java:11: ';' expected
myArray = { { {11,12,13,14},
^
ThreeDimensionalArray.java:11: illegal start of expression
myArray = { { {11,12,13,14},
^
ThreeDimensionalArray.java:12: not a statement
{15,16},
^
ThreeDimensionalArray.java:12: ';' expected
{15,16},
^
Please, can any one help me figure out the error??