This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
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.