I have created two classes and I am trying to invoke a constructor(with argument) and a method. I find it easy if I just use an object.
My Goal :
- To invoke the same method by using 3 objects.
- Use ArrayList to invoke the method 3 times.
My Homework:
I did google a bit. I happen to end with explanation of ArrayList and certain examples of it. I did not find examples which I think I need i.e. using ArrayList with Objects(like my citation).
public class DrawGraphics
{
BouncingBox box;
/** Initializes this class for drawing. */
public DrawGraphics()
{
box = new BouncingBox(200, 50, Color.green);
box.setMovementVector(1, 1);
}
//..................
//................
}
Thank you for those who try to help.
Continuing with your example this might give you an idea of what Lists can be used for:
Is this what you were looking for?