What am I missing here?
package com.codegym.task.task07.task0726;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.*;
/*
Cat code won't compile
*/
public class Solution {
public static ArrayList<Cat> CATS = new ArrayList<>();
public static void main(String[] args) throws IOException {
Scanner s = new Scanner(System.in);
String name;
int age, weight,tailLength;
while (true) {
name = s.next();
age = s.nextInt();
weight = s.nextInt();
tailLength = s.nextInt();
if (name.isEmpty()) break;
Cat cat = new Cat(name, age, weight, tailLength);
CATS.add(cat);
}
printList(CATS);
}
public static void printList(ArrayList<Cat> CATS) {
for (int i = 0; i < CATS.size(); i++) {
System.out.print(CATS.get(i).toString());
}
}
public static class Cat {
private String name;
private int age;
private int weight;
private int tailLength;
Cat(String name, int age, int weight, int tailLength) {
this.name = name;
this.age = age;
this.weight = weight;
this.tailLength = tailLength;
}
@Override
public String toString() {
return "Cat's name: " + name + ", age: " + age + ", weight: " + weight + ", tail: " + tailLength;
}
}
}