What's wrong with this?
// Assumg objectname instanceof Person
ArrayList humanCanWatch = new ArrayList(); // ArrayList of Person
Iterator i = humanCanWatch.iterator();
while (i.hasNext())
{
Person p = (Person)i.next();
if (p.canWatchMovie(rating, p.age))
System.out.println("can watch movie");
else
System.out.println("cannot watch movie");
}
Seems like it would work perfectly -- are you sure you were casting i.next()? What was the error you were getting?
Jon Emerson
http://www.jonemerson.net/