Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
The detailed answer for the above question is provided below The correct option is B To encapsulate ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started