It’s say’s type mismatch…. even if an appropriate type is selected….
I am attaching the code for better understanding….
public void calucate()
{
int Sum=0;
arraySumOfRows= new int[20];
for(int i=0;i<Array1.length;i++)
{
for(int j=0;j<Array1.length;j++)
{
Sum=Sum+Array1[i][j];
arraySumOfRows[i]=Sum;
}
}
for(int i=0;i<arraySumOfRows.length;i++)
System.out.println(Arrays.toString(arraySumOfRows[i]));
}
Two problems:
arraySumOfRows[i]is an integer andArrays.toString()expects an array. Just use:Your inner loop is wrong. I should be: