Your two-dimensional array a
is null.
Your intention is to initialize it inside the main()
method, but you declare new local array instead of initializing the global static array a
.
Your code should be like this:
public static void main(String[] ar) throws IOException {
n=7;
a = new int[][]{ {0,0,1,0,0,1,0},
{1,0,1,1,0,0,0},
{0,0,0,0,1,0,1},
{1,0,1,0,0,0,0},
{1,0,1,1,0,1,0},
{1,0,0,0,0,1,0},
{1,1,1,1,0,0,0}};
search(0,0);
System.out.println(path);
}