I am getting a nullpointer exception in the third line at runtime. Can you please explain.
Even if i remove the second line I still get the same thing.
Shouldnt hav the array elements be initilized with default values?
utsav gupta wrote:
So If I want assign the string "hi" at 0,0 location ,how do I do that?
In order to assign an element to a certain location, that array location has to exist. Remember an two-dimensional array, is an array of arrays in java -- you never instantiated any of the arrays for the array of arrays.