Given the code fragment:
Which code can be added to register both of these methods to receive BankEvent notifications only if an instance of BankActivityService is already instantiated in the current context?
Given the code fragment:
Which code can be added to register both of these methods to receive BankEvent notifications only if an instance of BankActivityService is already instantiated in the current context?
To register methods to receive notifications only if an instance of BankActivityService is already instantiated in the current context, you must use the @Observes annotation with the notifyObserver parameter set to IF_EXISTS before the method parameter declaration. This ensures that the methods are only invoked if the observer instance is already available. Therefore, the correct code is @Observes(notifyObserver=IF_EXISTS) on line 4 and line 7 before the method parameter declaration.
Correct answer D
correct answer D - before method parameter declaration
reference in the answer suggest that it is d.