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 c325111

Browse files
authored
Update README.md
1 parent 8ab5fe1 commit c325111

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

‎README.md‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,26 @@ Pattern Singleton: One Class, one Instance.
4444
There are many implementations of this pattern, but we will implement the Thread Safe one.
4545
Classes are in the package `com.Singleton`;
4646

47-
```java
47+
```java
48+
import com.singleton.SingletonThreadSafe;
4849

49-
import com.singleton.SingletonThreadSafe;
50+
public class SingletonTest {
51+
public static void main(String[] args){
5052

51-
public class SingletonTest {
52-
public static void main(String[] args){
53+
SingletonThreadSafe sing =SingletonThreadSafe.getInstance();
54+
System.out.println(sing);
5355

54-
SingletonThreadSafe sing = SingletonThreadSafe.getInstance();
55-
System.out.println(sing);
56+
// Now let's instanciate another class
5657

57-
// Now let's instanciate another class
58+
SingletonThreadSafe sing1 =SingletonThreadSafe.getInstance();
5859

59-
SingletonThreadSafe sing1 = SingletonThreadSafe.getInstance();
60+
System.out.println(sing1);
6061

61-
System.out.println(sing1);
62-
63-
//Now check out your console.... What the hell, the two instances have the same reference :o
62+
//Now check out your console.... What the hell, the two instances have the same reference :o
6463
}
6564
}
66-
```
65+
```
66+
6767
# Pattern Factory
6868

6969
Factory Pattern is one of the Creational Design pattern and it's widely used in JDK as well as frameworks like

0 commit comments

Comments
(0)

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