This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
John Jai wrote:books is declared to hold an int or an int array?
I am assigning a numerical value to an index 0 , isnt it right?
Joined: May 31, 2011
books is a multidimensional array that holds integer arrays. So book - is a place holder for an integer array. book for another and book another. The no. of integer arrays that book can hold is declared with the size 3.
Vishal Hegde wrote:Ok, so what does the 2 empty square bracket specify in this scenario?
Indicates that books is an array of arrays (multidimensional array)
so books, books, books would be 3 arrays each of whose length can be anything (as you havent mentioned the 2nd dimension value in the declaration. Do try out a full fledged program and see how it behaves.
Vishal Hegde wrote:ok if incase there are two  then it means it takes int array, but what if there are three square brackets  what in that case ??
Then it's an array of array of arrays. If you declare numbers as an int, then numbers is an array-of-arrays-of-ints, numbers is an array-of-ints, and numbers is an int.
The thing to remember is that arrays are just objects. You can have an array of any object you want, including other arrays. And arrays of those, and of those, etc. There's no absolute restriction on how many levels you can nest it as, but as you can imagine it gets difficult to follow so it's not a good idea to take it too far.