You created a new empty list and iterated by its elements (there are none). If this method must calculate what you want, use this:
public static double q1(ArrayList<String> input1){
double sum1 = 0;
for (String s1: input1){
sum1 += s1.length(); //Line 6
}
return Math.pow(sum1, 3);
}
solved Why won’t my method store the length of each array element into my variable? [closed]