我得到数组索引超出范围异常在prog的最后一行, output[1][1]
在那里产生这样的异常。但在前面的循环中,同样的事情仍然正常。数组索引超出范围异常无故
{
int ict=66,total_slots=12,h1=15,index_count=65;
String output[][] = new String[ict][total_slots+1];
for (int x = 0; x < (ict); x++)
output[x][0] = Integer.toString(x);
for (int y = 0; y < (total_slots + 1); y++)
output[0][y] = Integer.toString(y);
for (int x = 1; x <= (index_count); x++)
for (int y = 1; y <= (total_slots); y++)
output[x][y] = "n";
for (int x=1; x <= h1; x++) {
output[x][1]="y";//exception occurs here
limit[x]++;
}
}
欢迎来到Stack Overflow。请更注意代码的格式 - 如果没有任何缩进,*真的很难理解。请阅读http://tinyurl.com/stack-hints –
h1的价值是什么? – hasnae
@DenysSéguret:希望我的确如此:) –