嘿stackoverflow社区一直在这个程序上工作了几天,一直卡在这个错误一段时间,无法超越它。想知道是否有人可以提供有关正在发生的事情的见解。感谢所有回复。ArrayIndexOutOfBoundsException当打印一条线
这是当我运行该程序的输出:
27050
45200
22600
36250
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
at program10.Tax.printBrackets(Program10.java:69)
at program10.Program10.main(Program10.java:16)
下面是源代码的一些片段。 在主类是:
Tax tx = new Tax();
tx.setFilingStatus(tx.MARRIED_JOINTLY);
tx.setBrackets(2001);
tx.getBrackets();
tx.printBrackets();
根据税务类我有printBracket行这是在得到错误:
public void printBrackets(){
for (int i = 0; i < brackets.length; i++) {
for (int j = 0; i < brackets[0].length; j++) {
System.out.println(brackets[i][j] + " ");
}
}
}
最后是2001.brackets文件,它是拉动信息从:
20
27050 45200 22600 36250
65550 109250 54625 93650
136750 166500 83250 151650
297350 297350 148675 297350
2147483647 2147483647 2147483647 2147483647