Vijay When you create an array you can either use the form new int a[] = new int[5] or the form a[] = {1,2,3,4,5}; The first form explicitly creates an array of ints that has five elements. The second way implicitly does the same thing. The problem with your example is that your trying to recreate the same array. Once you've declared the size of the array the only way to get data into it is to specifically access each element and put a value into it. hope that helps

When i=0 and j=0, the output is one After i is incremented to 1 and j is incremented to 1, since anything after a[0] is undefined (due to the empty bracket in the declaration -- new int[5][] ), you get a NullPointerException.

Now if you created the array as: int a[][] = new int[5][5]; you would no longer get an exception because all the elements would be initialized (to zeros).

The point I was making is that you no longer get an illegal start of expression if you declare the array correctly.