Originally posted by RAMA KRISHNA CHOWDARY: I got 1 2 as output but expected Runtime exception.
That's a common misconception in the mind of those who have worked in C++ or similar languages. In Java, there is no such thing as a two dimensional array; rather, nested arrays are arrays of arrays. In your example, array contains two elements. These elements are actually references to arrays of String i.e. String. We can modify the reference contained in the first element of array, to point to any array of String, no matter what its size is. Hope this will help you understand the output.