I made a boolean[] called rects. Whenever I type in if (rects[j] == true) or for (boolean b : rects), I get an error saying non-static variable rects cannot be referenced from a static context. Could someone help me fix this and explain what this means?
public class Risk extends Applet implements MouseListener
{
private boolean[] rects;
public Risk()
{
boolean[] rects = new boolean[42];
}
public static void main(String[] args)
{
if (rects[j] == true) //ERROR
for (boolean b : rects) //ERROR
b = false;
}
}