Your program also has a second problem. You have this loop in both methods sumand print:
for (int i = 0; i < final23[i].length; i++)
In the sum method, this should be
for (int i = 0; i < final23[0].length; i++)
And in the printing method
for (int i = 0; i < final23.length; i++)
Otherwise, you will receive again ArrayIndexOutOfBoundsException.
, , . , .