Results 1 to 2 of 2
- 04-19-2012, 03:36 AM #1
Member
- Join Date
- Apr 2012
- Posts
- 4
- Rep Power
- 0
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.
Similar Threads
-
Calling overridden parent method of outter class from an inner class
By jlczuk in forum Advanced JavaReplies: 8Last Post: 04-18-2012, 04:58 PM -
Calling a method from another class
By andrewche in forum New To JavaReplies: 5Last Post: 05-04-2011, 04:46 AM -
Child-Class Calling a Method in a Parent-Class
By Blah_ in forum New To JavaReplies: 5Last Post: 09-29-2009, 02:48 AM -
Calling a method in a different class from within a method problem
By CirKuT in forum New To JavaReplies: 29Last Post: 09-25-2008, 07:55 PM -
Calling a method on original class from created class
By kpedersen in forum Advanced JavaReplies: 4Last Post: 08-20-2008, 12:25 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks