Every array in java is an object, here we can create by using new operators
int [] a = new int[3];
for every array type corresponding classes are available,but these classes are not applicable for prograrmmer level.
| Array Type | Correspomding Classname |
|---|---|
| int [] | [I@___ _ _ |
| int [] [] | [[I@.... |
| double[] | [D@.... |
At the time of construction complusury we should specify szie otherwise we will get C.E.
It is legal to have an array with size O in java
int [] a = new int [0];
if we are specifying array size as -ve int value, we will get runtime exception saying NegetiveArraysizeExeption. To specify array size the allowed datatypes are byte,short,int,char, if we using any other types we will get c.e.
- The max allowed array size in java is 2147483647
Tags:
Java
