posted 19 years ago
You can declare an array of unknown size like this:
int[] array;
but there's no array object there. You can't use "new" to actually create the object until you actually know the size.
If you don't know the size -- that's what we're talking about here, right? -- then don't use an array: use one of the Collections classes in java.util. For example, java.util.ArrayList, which is rather like an array, but it grows automatically as you add items to it.