This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Actually your original code has some poor style. You should but the  earlier.
Needless to say, this sort of question comes up frequently, and here is some good discussion of it. But as Fred has already hinted, you are not creating a 2D array.
Joined: Dec 17, 2011
Thanks for the replys.
So I should declare arrays this way
is that right?
and no I didnt relise that arrays could hold other arrays but I do now!Will look in to it further just to make sure I have the understanding of them correct.
Joined: Oct 13, 2005
Yes, you should declare arrays like that,  before the name of the array. That is because the variable is of type something-array, so you declare the type as something-array, then the name.
int arr is not a 2D array, but a 1D array containing however many 1D arrays. Or more precisely, enough memory put aside to contain that in the reference. arr is a 1D array, provided arr has been instantiated with enough elements to support an index of 123.