Every array in Java is dinamically assigned at runtime,
this is why the definition of an array does not include
the number of elements. The number of the elements is
included in the initialization part.
So, you can do something like that:
double[] x = new double [10];
Or with an known number at compile time:
int n;
double[] x;
...you can read n from a file or user input here...
x = new double [n];
Or make another variable point to this variable, so
the both variables will share the same memory space.
double[] y = x;
This is not like C, where you define a number of
elements at compile time, and obviously this number
has to be constant. Well, in C++ you can create
arrays dynamically similar to Java.
But in Java, once you have assigned n entries for
your array you cannot change the number of elements,
as Nico said you can use a container class for that,
like ArrayList or Vector.