Calling a Method in all Objects of a Class
I am using a method that prints out information relating to one object, yet I need to print this information for all objects. Rather then writing object1.print(); object2.print(); etc etc, is there a way to just call them all at once, such as by using the class name?
Any advice would be appreciated, thankyou!
Re: Calling a Method in all Objects of a Class
You probably want a collection of objects such as putting them all into an ArrayList and call the method on all objects in the list via a for loop.