Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8b2da9a

Browse files
authored
Update README.md
1 parent 82459f3 commit 8b2da9a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Pattern Singleton: > One Class, one Instance.
3434
Singleton pattern restricts the instantiation of a class and ensures that only one instance of the class exists in the java virtual machine. The singleton class must provide a global access point to get the instance of the class. Singleton pattern is used for logging, driver objects, caching and thread pool. Singleton design pattern is also used in other design patterns like __Abstract Factory__, __Builder__, __Prototype__, __Facade__ etc. Singleton design pattern is used in core java classes also, for example __java.lang.Runtime__ , __java.awt.Desktop__.
3535

3636
To implement Singleton pattern, there are really many approaches but all of them have following common concepts:
37+
3738
* A private constructor to avoid instantiation of the class,
3839
* A private static variable from the same class that's the only instance of the class.
3940
* public static method that returns the instance of the class, this is the global access point for the outer world to
@@ -91,7 +92,8 @@ Factory design pattern is used when we have a super class with multiple sub-clas
9192
//Now you can see the output in your console.
9293
}
9394
```
94-
This pattern provides some advantages such as :
95+
This pattern provides some advantages such as :
96+
9597
* It provides approach to code for the interface rathan than the implementation.
9698
* It removes the instantiation of the actual implementation classes from client code, making it more robust.
9799
* It provides abstraction between implementation and client classes through inheritance.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /