Please, I need help on how to print out my object correctly.
I can't override the toString method because of the last requirement;
Requirement: The printCats method should display all the cat objects in the variable cats. Each on a new line.
package com.codegym.task.task06.task0614;
import java.util.ArrayList;
/*
Static cats
*/
public class Cat {
//write your code here
public static ArrayList<Cat> cats = new ArrayList<>();
public Cat() {
}
public static void main(String[] args) {
//write your code here
for (int i = 0; i < 10; i++) {
Cat cat = new Cat();
cats.add(cat);
}
printCats();
}
public static void printCats() {
//write your code here
for (int i = 0; i < cats.size(); i++){
System.out.println(cats.get(i));
}
}
}