Do Java's regular arrays have built in methods? -
Do Java's regular arrays have built in methods? -
i know regular java array int[] arr = new int[5];
lives in heap , hence considered object. although considered object different other java obects because cannot other java objects can.
one of books read java says,
"even though array object, lives in own special world , can't invoke methods on it, although can access 1 , instance variable, length"
this book based on java 5.0.
i using netbeans ide, , strangely plenty noticed methods can invoked on array object "arr".
arr.equals() arr.clone() arr.getclass() --> gives class [i, , don't know means
was book wrong, or these methods introduced in recent versions? , class [i
an array reference type, means it's sub-class of object
. hence methods of object
can invoked on arrays. perhaps book meant arrays don't introduce array specific methods.
[i
class name of int array (int[]
).
java arrays
Comments
Post a Comment