Question: 1. Which Design Pattern does the following code snippet implement? public class ExamplePattern { private static ExamplePattern instance = null; protected Example Pattern() { }
1. Which Design Pattern does the following code snippet implement?
public class ExamplePattern {
private static ExamplePattern instance = null;
protected Example Pattern() {
}
public static ExamplePattern getInstance() {
if(instance == null) {
instance = new ExamplePattern();
}
return instance;
}
}
Explain how this is accomplished.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
