views:

91

answers:

2

Where can i find the source code for java arrays?

Example:

double[] arr=new double[20];

All array's with any dimension implements Cloneable and Serializable interface.I searched the source code but couldn't find the code for this.Any help would be great.

+7  A: 

Have a look at this for an explanation. But basically the array type is built-in to the jvm and you need to analyze the source code for the jvm you are running in order to truly know how it works.

controlfreak123
+1  A: 

Here is the javadocs for java.util.Arrays and here is the implementation of java.util.Arrays in openjdk. Google Code search is a good way to go about it.

UPDATE 1: Link updated. Posted the wrong link.

UPDATE 2: As pointed out by thilo, the jvm implementation of Array is here

zengr
I think he's asking about the infrastructure that allows you actually create arrays. `java.util.Array` is just a utility class.
Matthew Flaschen
Note that this is the source for the Arrays utility class (not the native array data type).
Thilo
Thilo
I have updated my answer but, @thilo deserves the acceptance of the answer :)
zengr