How can I get all sum of data from arraylist in a for loop?

try this code

  int sum = 0;
    for(int i = 0; i <=dailyList.size(); i++) {
        dailyExerciseID = dailyList.get(i).getDcExerciseId();
        dailyExerciseName = dailyList.get(i).getDcexerciseName();
        points = dailyList.get(i).getPoints();
        sum = sum + points;
    }

Browse More Popular Posts

Leave a Comment