According to me this is what is causing the problem :-
int mat1[][];
You have never initialized your matrix, with any size.
You will have to initialize your matrix as follows to be able to use it:-
int[][] mat1 = new int[3][4];
Heres a tutorial to help you on arrays.