[Solved] Exception in thread main error in array program


int arrayfirst[] [] ={{1,2,3},{2,3,4}};
int arraysecound[] [] ={{3,4,5},{6,7,8}};

here, arrayfirst and arraysecound contain two rows and three columns each (The number of inner curly braces separated by Comma signify number of rows, and the numbers written within these inner curly braces signify number of columns), so when you add their elements and try to store the result, you again need an array that has two rows and three columns.

so, just replace

int result[][]= new int [2][2];
with
int result[][]= new int [2][3];

solved Exception in thread main error in array program