Possible Duplicate:
Why isn't there a java.lang.Array class? If a java array is an Object, shouldn't it extend Object?
I'd created an array say:
int a[] = new int[50];
Here, int
is a primitive data type but in java, arrays are created at run-time which means that there would be an object of some class.
So, I would like to know which class object they are and what the background process happen while making array object?
And one more thing I would like to know, if I would like to print the reference id of that array:
System.out.println(a);
then the output is certain kind of [I@17182c1
Here I know that string before the @ is class name and after @ is the hashcode. But which class is [I
?
How [I
class is created and where from I got the variable length
which return the length of the array? I had not found class [I
in the whole API of Java, then why don't compiler shows error if I write:
System.out.println(a.length);
as the class [I
will be created at run-time?