The two lines:
data = scan.nextInt(); array[ index ] = data ;
can be replaced by the single line:
array[ index ] = scan.nextInt();
And then the declaration int data;
should be removed.
An array object is constructed as the program runs (as are all objects). When an array is constructed, its size can be in a variable. Here is the previous example, with some modifications:
Fill in the blank.