Problem : Java, for loop: is not a known variable in the current context

Problem : Java, for loop: is not a known variable in the current context

I am making an application in Java with GWT to sort out an Arraylist.

– The thing is that I am into a “static class”.

– Into this class I have a “private String[[ createClubArrays(List list)” mehod which returns a String array of 2 dimensions.

-I want to sort-out this arraylist with a little method:
“public String[[ SortOut (String [[ DataList)”. It is very simple, it uses two for-loop to go through the arraylist and sort it out.

– The problem is when I mouse over the “i” for-loop variable, it says  “it is not a known variable in the current context”. This is the line of code I am talking about:

for (int i=0;NumClubs

– I attached as well the piece of code where I have the problem as well.

I would appreciate any clue.


Solution: Java, for loop:  is not a known variable in the current context

From the screenshot you’ve attached, it looks like you haven’t gotten into the for loop yet during debugging when you are doing the mouseover.  The variable ‘i’ isn’t in scope until you are inside the loop.  Try putting a breakpoint at the line:

String name1=DataList[i][1];

Once you’ve entered the loop, ‘i’ will be visible to the debugger.