Java 3D 数组初始化

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2987686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 23:50:23  来源:igfitidea点击:

Java 3D array initialization

javaarrays3d

提问by xdevel2000

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

我需要表示一些空间点: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?

错误在哪里?

回答by bakkal

You just forgot the =sign and a semicolon ;

你只是忘记了=符号和分号;

int[][][] points = {{{100, 120, 10}, {100, 120, 18}}};

回答by Upul Bandara

int[][][] points = {{{100,200,300},{120,200},{200,250}}};