I have an interface called ClientRegistrationListener
public interface ClientRegistrationListener {
void onClientAdded(Client client);
}
And I also have in the main class an ArrayList of ClientRegistrationListener. In this list I add listeners for my class.
listeners.add(new PrintClientListener());
where PrintClientListener is a class created in this main class
class PrintClientListener implements ClientRegistrationListener, Serializable {
private static final long serialVersionUID = 2777987742204604236L;
@Override
public void onClientAdded(Client client) {
System.out.println("Client added: " + client.getName());
}
}
My question is how can I replace the listeners from the Bank class with
anonymous classes?