@@ -43,27 +43,24 @@ Pattern Singleton: One Class, one Instance.
4343 Singleton is one of the Gangs of Four Design patterns and comes in the Creational Design Pattern category.
4444There are many implementations of this pattern, but we will implement the Thread Safe one.
4545Classes are in the package ` com.Singleton ` ;
46+ ``` java
47+ import com.singleton.SingletonThreadSafe ;
4648
47- ```java
48- import com.singleton.SingletonThreadSafe;
49-
50- public class SingletonTest {
51- public static void main(String[] args){
52-
53- SingletonThreadSafe sing = SingletonThreadSafe.getInstance();
54- System.out.println(sing);
49+ public class SingletonTest {
50+ public static void main (String [] args ){
51+ SingletonThreadSafe sing = SingletonThreadSafe . getInstance();
52+ System . out. println(sing);
5553
56- // Now let's instanciate another class
54+ // Now let's instanciate another class
5755
58- SingletonThreadSafe sing1 = SingletonThreadSafe.getInstance();
56+ SingletonThreadSafe sing1 = SingletonThreadSafe . getInstance();
5957
60- System.out.println(sing1);
58+ System . out. println(sing1);
6159
62- //Now check out your console.... What the hell, the two instances have the same reference :o
60+ // Now check out your console.... What the hell, the two instances have the same reference :o
6361 }
6462 }
6563 ```
66-
6764# Pattern Factory
6865
6966 Factory Pattern is one of the Creational Design pattern and it's widely used in JDK as well as frameworks like
0 commit comments