why do we have to use the:for(Cat cat :cats )
hidden #10424566
Level 7
quiz
Archived
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Guadalupe Gagnon
25 February 2019, 16:48
You don't. Inside the printCats method you can use any technique that will print all the Cat objects on screen that are contained in the 'cats' list.
0
Minh Phạm Đức
25 February 2019, 12:32
It is for the ease of looping
You can also do it the other way like this with less readability...:
for (int i = 0; i<cats.size(); i++) {
System.out.println(cats.get(i));
}
+3