View Single Post
  #1 (permalink)  
Old 04-30-2008, 05:30 AM
rattle rattle is offline
Member
 
Join Date: Apr 2008
Posts: 3
rattle is on a distinguished road
Calling a method for all instances of an object
Hi
Code:
import java.lang.*; import java.util.*; public class BankManagement{ public static void main(String[] args) { //vars, objects // construct instances of BankAccount and pass initial account information // account-no First Last Type balance credit BankAccount acc01 = new BankAccount(3856296735L,"Jenny","Popdeck","savings",4820.88,-50); BankAccount acc02 = new BankAccount(3478957793L,"Alex","Fryhall","credit",11899,-10000); BankAccount acc03 = new BankAccount(3709409798L,"Joey","Boilcraft","check",333.60,0); } }
given the above and my BankAccount class has a method getDetails() which prints a formatted list of vars for the account object.

Please suggest a way of running the method for all instances of the BankAccount object which would essentially be

Code:
acc01.getDetails();acc02.getDetails();acc03.getDetails();
but automatic


thanks in advance for your considerate help
mick

Last edited by rattle : 04-30-2008 at 05:34 AM. Reason: typos typos typos!!
Reply With Quote
Sponsored Links