loop an array of objects in java

Java
for(Dog d : kennel) {
    d.bark();
}
Source

Also in Java: