How to remove an object?
package fr.codegym.task.task08.task0819;
import java.util.HashSet;
import java.util.Set;
/*
Ensemble de chats
*/
public class Solution {
public static void main(String[] args) {
Set<Chat> chats = creerChats();
a.remove(Chat.b);
//écris ton code ici. Étape 3
imprimerChats(d);
}
public static Set<Chat> creerChats() {
//écris ton code ici. Étape 2
HashSet a = new HashSet<Chat>();
Chat d = new Chat();
Chat b = new Chat();
Chat c = new Chat();
a.add(d);
a.add(c);
a.add(b);
return a;
}
public static void imprimerChats(Set<Chat> chats) {
// Étape 4
for (Chat texte : chats)
{
System.out.println(texte);
}
}
// Étape 1
public static class Chat{
String nom;}
}