我在第39行收到错误。如果我的长度合适,我为什么会收到此错误?我的长度应该是6,for循环从0开始,到5,应该覆盖数组中的所有6个数字。
public class HW7
{
public static void main(String args[])
{
int fo0[] = {10, 6, 6, 9, 4, 7};
int fo1[] = {7, 5, 4, 8, 2, 2};
int sum1 = 0;
int sum2 = 0;
int j, a, b, c, d;
double e;
for(j=0; j<fo0.length; j++) // will calc the sum of all rows for fo0
{
sum1 = fo0[j] + sum1;
}
System.out.println(sum1);
for (a=0; a<fo1.length; a++) //will calc the sum of all rows for fo1
{
sum2 = fo1[a] +sum2;
}
System.out.println(sum2);
int rsum[] = new int[6]; //Creates row sums arrays
for(b=0; b<fo0.length; b++)
{
c = fo0[b] + fo1[b];
rsum[b] = c;
}
int GrandTotal = sum1 + sum2; //Grand Total
double fe0[] = new double[6];
double fe1[] = new double[6];
for(d=0; d < fe0.length; d++);
{
e = ((sum1 * rsum[d])/GrandTotal);
fe0[d] = e;
}
int test;
for(test=0;test<rsum.length; test++)
{
System.out.println(rsum[test]);
}
}
}
我在第39行收到错误。