You can declare the array size: Object This is meaningful if you make an empty array. But since you are providing values in the declaration it will take the size from the values. I'm pretty sure. Try this for fun and illumination:
This says the array holds two items but I only provided one value. See if it held the second position with a null or if you get an index out of bounds exception. And let me know.
If you know the answer ... don't tell!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
OK, now I think I know what the issue is: you want, somehow, the Java array variable's type to include the size of the array -- is that it? In Java, array variables don't include any notion of dimensions. Even if you allocate an array at some fixed size -- i.e.,
int array = new int;
there's nothing about the variable "array" that includes the notion of 64-ness or 8-ness, and you can later say