If the type of my ArrayList is not an Integer (They are called Objects), how can I get the sum inside of the list? newlist.get(i) will return Object and I can't sum with "sum".
ArrayList newlist = new ArrayList();
newlist.add(1);
newlist.add(2);
newlist.add(3);
newlist.add(4);
for (int i = 0; i < newlist.size(); i++) {
sum = newlist.get(i) + sum;
}
List<Integer>?