I'm trying to have my method "add" access the contents of an ArrayList that was created in method "Friends", but Java isn't happy with what I'm doing (scope issues?). Is there a way to fix the problem without having to pass arguments?
public class Friends {
public Friends(float x, float y)
{
ArrayList<MyObject> arrayList = new ArrayList<MyObject>();
MyObject[] friendList = new MyObject[20];
}
public void add()
{
for (int i = 0; i < 20; i++) {
//friendList[i]
}
}
}
note that Friends is meant to be a constructor (if I'm using that word right)