-2

What does the below line of code mean? is it a legal way to declare or define an array. I googled it but couldn't find any information regarding this.

int[] []x[]

prity
  • 992
  • 8
  • 14

1 Answers1

-1

This is a valid line of code. It references a 3 dimensional integer array. Following codes are equivalent:

int[][][]x

int[][]x[]

int[]x[][]

int x[][][]

All of them are reference to a 3 dimensional integer array. You can declare a 10x10x10 size array like the following:

x = new int[10][10][10];

Nayan
  • 1,362
  • 2
  • 12
  • 25