This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Nothing is wrong with ArrayList. Unless you override toString(), it prints out the name of the object you called it on plus a number (memory location, hash code, I forget). Override TestAccount.toString() to do something meaningful. [ October 22, 2003: Message edited by: Joe Ess ]
For what it's worth, because of the polymorphic nature of Java it's not necessary to cast the ArrayList elements before printing them out. The following would work just as well:
At run time the system would determine that the element being printed--addTestAcc.get(i)--is a "TestAccount", and call the appropriate "toString()" method. You only need to do an explicit cast to call a method that's defined in that class.