Я не понимаю почему у меня не работает
package en.javarush.task.jdk13.task08.task0820;
import java.util.HashSet;
import java.util.Set;
/*
Animal set
*/
public class Solution {
public static void main(String[] args) {
Set<Cat> cats = createCats();
Set<Dog> dogs = createDogs();
Set<Object> pets = join(cats, dogs);
printPets(pets);
removeCats(pets, cats);
printPets(pets);
}
public static Set<Cat> createCats() {
Set<Cat> result = new HashSet<Cat>();
//write your code here
Set<Cat> c = new HashSet<>();
c.add(new Cat());
c.add(new Cat());
c.add(new Cat());
c.add(new Cat());
return c;
}
public static Set<Dog> createDogs() {
//write your code here
Set<Dog> d = new HashSet<>();
d.add(new Dog());
d.add(new Dog());
d.add(new Dog());
return d;
}
public static Set<Object> join(Set<Cat> cats, Set<Dog> dogs) {
//write your code here
Set<Object> animals = new HashSet();
for(Cat c:cats){
animals.add(c);
}
for(Dog d:dogs){
animals.add(d);
}
return animals;
}
public static void removeCats(Set<Object> pets, Set<Cat> cats) {
//write your code here
pets.removeAll(cats);
}
}
public static void printPets(Set<Object> pets) {
//write your code here
for(Object pet:pets){
System.out.println(pet);
}
}
public static class Cat{}
public static class Dog{}
//write your code here
}