Question: Question: What is the primary function of the strategy pattern in Java? A ) To represent a one-to-many dependency between objects, helping to notify dependents
Question: What is the primary function of the "strategy pattern" in Java?
A ) To represent a one-to-many dependency between objects, helping to notify dependents of state changes.
B ) To encapsulate algorithms within a class, allowing for dynamic selection of an algorithm at runtime.
C ) To ensure that a class has only one instance and provides a global point of access to that instance.
D ) To define a common interface for a family of related objects and encapsulate their creation.
Step by Step Solution
There are 3 Steps involved in it
The detailed answer for the above question is provided below The correct option is B To encapsulate ... View full answer
Get step-by-step solutions from verified subject matter experts
