Java multidimensional array viewed as primitive or object
3 answers
Arrays are objects. Arrays of arrays are also objects. Java doesn't really have multidimensional arrays per se, it just supports arrays of arrays.
int [][] foo = {{1}, {2,2}, {3,4,5}};
if (foo instanceof int[][]) { // can only use instanceof with objects
}
System.out.println(foo.getClass()); // has object methods
+5
source to share
In java, arrays are full blown objects. Having said that, all primitives and object references in java are always passed by value and never referenced. In the case of objects, the reference to the object is passed by value. The difference between this and passing by reference is subtle but significant.
+2
source to share