Array Lists
807597Feb 2 2005 — edited Feb 2 2005I am trying to initialize an array list in my program.
I have imported import java.util.*;
import java.util.ArrayList;
I have a variable "private ArrayList arrayofSquares"
in my constructor I have this "arrayofSquares=new ArrayList();"
I want to add numbers like 1,2,3 and 2,3,4 to each index of the list down futher in a for loop.
My complier gives the error "non ststic variable arrayofSquares cannot be referenced from a static context arrayofSquares=new ArrayList();"
Can anyone please tell me where i am going wrong
Thanks