Ok so I have a class called Dog() which takes two parameters, a string and an integer.
This class has a method called bark(), which prints a string depending on the intege
Here's how you do it using enhanced for loop.
for(Dog dog : kennel) {
dog.bark();
}
For your other question, if you're going to be using arrays, you'll have to declare the size before you start adding elements to it. One exception, however is if you are doing both initialization and declaration in the same line. For example:
Dog[] dogs = {new Dog("Harold", 1), new Dog("Arnold", 2)};