posted 13 years ago
Is it possible in anyway to declare an array like this.
static int arr[]=new int[2];
arr={0,0};
and later on in same program
arr={0,1};
The compiler is giving me error "illegal start of expression".
Now why is this so,
as we can declare array like this
static int arr[]=new int[2];
and then initialize it
arr[0]=0;
arr[1]=0;
then may be at some time of the program reinitialize it to
arr[0]=0;
arr[1]=1;
So when the length of an array is too large, its inconvenient to use the second method.
So how can we use the first method?