0

Hi all,

I have the following task;

Extend an ArrayList of Integer by adding a method called 'sum', that returns the total sum of the elements of the list of integers. Such that each time the method is called sum up all the integers.

So I started by making the following code but it is not working! Any Help Please.

```
import java.util.ArrayList;
public class Sum extends ArrayList<Integer> {
ArrayList<Integer> num = new ArrayList<Integer>();
num.add(1);
num.add(13);
num.add(24);
num.add(65);
num.add(67);
num.add(89);
return (num);
public Integer Sum() {
Double subtotal = 0.0;
for (Double d : num) {
subtotal += d;
}
}
}
```

Please Help :S