We were practicing how to implement a loop with For. We use Pet/Dog/DogMaster classes to realize a loop. We rewrite Function say() in Dog to make it have two assumptions instead of one, so it is public String say(String aWord, int howManyTimes). aWord is what Dog wants to say, howManyTimes is just how many Times Dog wants to repeat aWord.
In DogMaster, we call say (“arf!”, 10). It means we expect myDog can “arf!” for ten times.
Let’s run DogMaster, and see what’s going on in Console. Let’s count how may “arf!” there.
In the next section, we will learn some logic operators.