Campbell Ritchie wrote:
Afraid you are mistaken: you are using the int in line 2 to find the individual numbers, so that code is correct.
Marco Ulrich wrote:. . . the elements of arr, are int not ints. . . .
Since arrays don't override Object#toString(), that code won't print the elements at all. I think you shouldn't sit the exam until you have more experience.
. . .
In real life, use this method.
I think you got me wrong. I know that Arraay don`t ovverride the toString Method. Anyway the Java Specification says that the toString Method returns a String Represantation of the Object wich is Classname@hashcode. There are also these Questions with Arraylists wich inherits toString from AbstractCollection.
My point is in my opinion an Array of int arrays holds int array ,not int values. So the elements of int arr, are Arrays that holds int's.
I know how to get all the numbers of the inner Arrays. But I want to know what, according to oracle, is the correct definition of an element in an array.
I don't think I'm not ready for the OCA, but if you think you should blame me for this question, feel free to do it again
Maybe you should read the Documentation that you are sharring.
Elements are converted to strings as by String.valueOf(Object), unless they are themselves arrays.
If an element e is an array of a primitive type, it is converted to a string as by invoking the appropriate overloading of Arrays.toString(e). If an element e is an array of a reference type, it is converted to a string as by invoking this method recursively.
So the elements of multidimensional Arrays are Arrays