Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java 3D array initialization

Tags:

java

arrays

3d

I need to represent some spatial points: x,y,z

when I try to initialize the array like this:

int[][][] points
{
   {
      {100, 120, 10},
      {100, 120, 18},
      ...
   }
}

I got an error: Uncompilable source code - not a statement

where is the error?

like image 967
xdevel2000 Avatar asked Dec 05 '22 02:12

xdevel2000


2 Answers

You just forgot the = sign and a semicolon ;

int[][][] points = {{{100, 120, 10}, {100, 120, 18}}};
like image 72
bakkal Avatar answered Dec 07 '22 16:12

bakkal


int[][][] points = {{{100,200,300},{120,200},{200,250}}};
like image 41
Upul Bandara Avatar answered Dec 07 '22 14:12

Upul Bandara