I have a BankAccount super class and some subclasses of Bank Account that all work fine.
If I try to access the data in a ArrayList of bank account objects directly from main, everything is good. If I try to have a method do it instead and pass the ArrayList to the method, my attempts to access the objects are met with compiler statements about incompatible types. I thinks it must have something to do with how the ArrayList is passed to the method, but I am not sure how to solve this problem
this is the method that is called from main
public static void verifyAccount (String acctName, ArrayList accountDataBase)
BankAccount b = new BankAccount();
for(int i = 0; i< accountDataBase.size(); i++)
b = accountDataBase.get(i); //this line generates compiler error
When I compile this, I am told of an incompatible type: found is a java lang object, but what is needed is a BankAccount object.
when I defined "b" as in the following code
Object b = new Object(), it compiled, but it's worthless since I don't know what to do with it. Totally stuck. Any help appreciated.
This post has been edited by garrettcampbell: 30 March 2009 - 03:15 AM