Right event implementation

Report a typo

You have the following listener for TestEvent in your application:

@Component
public class TestListener implements ApplicationListener<TestEvent> {

    @Override
    public void onApplicationEvent(TestEvent event) {
        //event handling
    }
}

Choose all possible implementations of TestEvent according to the given listener.

A)

public class TestEvent {
}

B)

public class TestEvent extends ApplicationEvent {
}

C)

public class TestEvent extends ApplicationEvent {

    private final String message;

    public TestEvent(Object source, String message) {
        super(source);
        this.message = message;
    }

    public String getMessage() {
        return message;
    }
}

D)

public class TestEvent extends ApplicationEvent {

    public TestEvent(Object source) {
        super(source);
    }
}

E)

public class TestEvent extends ApplicationEvent {

    private final String message;

    public TestEvent(String message) {
        this.message = message;
    }

    public String getMessage() {
        return message;
    }
}
Select one or more options from the list
___

Create a free account to access the full topic