我正试图从我的2d String数组中获取默认的空值.
到目前为止我已经有了这个.
String[][] sterren = new String[12][37];
int h = 12;
String leeg = "";
while(h > 0){
int b = 37;
sterren[h][b] = leeg;
while(b > 0){
sterren[h][b] = leeg;
b = b-1;
}
h = h-1;
}
Run Code Online (Sandbox Code Playgroud)
h =高度,b =宽度
当我尝试执行此操作时,我在行上获得了一个arrayindexoutofbounds 12 sterren[h][b] = leeg;.为什么这是因为我清楚地制作了12列和37行.
java arrays multidimensional-array indexoutofboundsexception