how do you get the sum of a java arraylist?

your loop misses braces (for (...){code here}). It only sees the immediate next line (weeklySales...) as belonging to it, but not the second. So i is not in scope there.

Then you’re using an array, not a list, you access it using data[i] rather than data.get(i)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top