Need some advice for a project in an intro Java class. I'm stuck at creating a assignment constructor which takes an array as input and completes a deep copy. The constructor in question is found in the second block of code.
import java.util.Scanner;
public class NumberList
{
public static final int MAX_CAPACITY = 100;
private double [] numbers;
private int length;
public NumberList()
{
numbers = new double[MAX_CAPACITY];
int i;
for(i = 0; i < MAX_CAPACITY; i++)
numbers[i] = 0;
length = 10;
}
Everything before this line compiles. The constructor below is to complete a deep copy from the array parameter to the numbers array.
NumberList(final double a[])
{
double a[] = new double[MAX_CAPACITY];
numbers = a[];
}
Following errors received:
NumberList.java:67: error: '.class' expected
numbers = a[];
For the life of me, I cannot figure out how to do fix this. I've tried with a "for" loop, as well.