I'm writing a method that takes an ArrayList and uses the element at a certain index in a different location , yet when I use the .get(int) method in the code, I get an error.
static void linreg(ArrayList<Integer> x[], ArrayList<Integer> y[]) {
double sum_x = 0, sum_y = 0, int n = 15;
for (int i = 0; i < n; i++) {
sum_x += x.get(i); - Cannot invoke get(int) on the array type ArrayList<Integer>[]
sum_y += y.get(i); - Cannot invoke get(int) on the array type ArrayList<Integer>[]
Is there a way to fix this? Thanks
[]. They don't do what you think they do.List<List<Integer>>construct than to mix arrays with lists as you're trying to do.