Check out example codes for "loop an array of objects in java". It will help you in understanding the concepts better.

Code Example 1

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

Learn ReactJs, React Native from akashmittal.com