This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Aruna Balasuriya wrote:
According to declaration x may contain only 5 values but I fill 7 values but it wont generate array out of bound exception.why?
Keep in mind that Java doesn't really support multidimensional arrays. It supports arrays of arrays. When you instantiated the two dimensional array, the new operator instantiates an array of size three, and then instantiates int arrays of size 5, in each of the three array elements.
In the next statement, you are instantiating an int array of size seven, and replaced the first element of the int array array with it. So, X is an array of arrays, with the first element having an int array of size 7, and the other two elements having an int array of size 5.