Answer Posted / supraja
The Singleton pattern
In Design Patterns, the authors describe the Singleton
pattern like this:
Ensure a class has only one instance, and provide a global
point of access to it.
The figure below illustrates the Singleton design pattern
class diagram.
Singleton class diagram
As you can see from the figure above, there's not a whole
lot to the Singleton design pattern. Singletons maintain a
static reference to the sole singleton instance and return
a reference to that instance from a static instance()
method.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Which is better stringbuilder or stringbuffer?
Can we declare register variable as global?
What is integers and example?
Which is dependent variable?
Explain about anonymous inner classes in java?
Can we instantiate interface in java?
Explain the importance of finally block in java?
What language is an assembler written in?
How do you implement singleton class?
How we can make copy of a java object?
What is a boolean flag in java?
Does anyone still use java?
Why singleton pattern is better than creating singleton class with static instance?
Are floats faster than doubles?
Similarity and difference between static block and static method ?