Ok, I think I have found the answer
ArrayList<Circle> circleArray = new ArrayList();
void draw()
{
if(keyPressed)
{
Circle test = new Circle(mouseX, mouseY);
circleArray.add(test);
}
println(circleArray.size());
for(Circle circles : circleArray)
{
circles.display();
}
}
The other class simply has a constructor that takes 2 floats x and y as inputs, and display() draws a circle with x and y and a fixed size.
It works just fine until I add “background(0);” at the beginning of my draw() method, after which nothing is added to my ArrayList (println returns 0.0), so I guess it has other properties