我想知道在 java 中是否有一种方法,当迭代数组并将值放在某些索引中时,可以跳过越界异常并转到下一项。
例如,
for (int x = 0; x <= array.length; x++)
{
for (int y = 0; y <= array[0].length; x++)
{
// code that determines where to put things and in what indices
//if this index is out of the array bounds, I want to forget about it and keep going through the loops
}
}
}