I have an arrayList with a number of different objects including Log, Frog, Turtle, Rock etc.
I would like to perform some action that only applies to the class types that implements and interface, IAction.
Is there something built in in Java that can do this?
My attempt:
for(Object o : objectList){
if(o.getClass instanceof IAction){ // doesnt work
// doWork
}
}
You check the instance, not the class: