Question: Question: What is the primary benefit of using the singleton pattern in Java? A ) It provides a way to encapsulate algorithms and make them
Question: What is the primary benefit of using the "singleton pattern" in Java?
A ) It provides a way to encapsulate algorithms and make them interchangeable.
B ) It ensures that a class has only one instance and provides a global point of access to that instance.
C ) It allows for the separation of concerns by dividing code into multiple classes with distinct responsibilities.
D ) It enables the dynamic creation of objects based on varying input parameters.
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 It ensures that a class has only one instance and provides a glob... View full answer
Get step-by-step solutions from verified subject matter experts
