Getting error while using for each loop


When using for each loop, getting this error but working perfectly on “for” loop.
link to ide : https://ide.codingblocks.com/s/268727

@mr.dheeraj000 hi bro! in for each you are adding in returnedResult instead of result, here i have corrected it.
If your query is cleared mark it resolved and rate full!
import java.util.*;
public class Main {
static ArrayList getBoardPath(int current,int end)
{
if(current==end)
{
ArrayList baseresult= new ArrayList();
baseresult.add("");
return baseresult;
}
if(current>end)
{
ArrayList baseresult= new ArrayList();
return baseresult;
}
ArrayList result= new ArrayList();
for(int i=1;i<=6;i++)
{
ArrayList returnedResult= getBoardPath(i+current,end);
for(String ss : returnedResult)
{
result.add(i+ss); //result not returnedResult
}
// for(int x=0;x<returnedResult.size();x++)
// result.add(i+returnedResult.get(x));

    }
    return result;

}
public static void main(String args[]) {
    System.out.println(getBoardPath(0,10));
}

}

Thanks Kartik , got it!!