Skip to content

Commit e22211f

Browse files
committed
Update java-design-pattern-questions.md
1 parent 8a54b3e commit e22211f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

java-design-pattern-questions.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
## Java Design Pattern Questions and Answers
2-
3-
1+
# Java Design Pattern Questions and Answers
42

53
#### Q. Exaplain MVC, Front-Controller, DAO, DTO, Service-Locator, Prototype design patterns?
6-
*TODO*
74

8-
#### Q. What are the design patterns available in Java?
5+
*ToDo*
6+
7+
## Q. What are the design patterns available in Java?
98
Java Design Patterns are divided into three categories – creational, structural, and behavioral design patterns.
109

1110
**1. Creational Design Patterns**
@@ -42,7 +41,7 @@ Java Design Patterns are divided into three categories – creational, structura
4241
* Dependency Injection Pattern
4342
* MVC Pattern
4443

45-
#### Q. Explain Singleton Design Pattern in Java?
44+
## Q. Explain Singleton Design Pattern in Java?
4645
**1. Eager initialization:**
4746
In eager initialization, the instance of Singleton Class is created at the time of class loading.
4847

@@ -149,7 +148,7 @@ public class BillPughSingleton {
149148
<b><a href="#">↥ back to top</a></b>
150149
</div>
151150

152-
#### Q. Explain Adapter Design Pattern in Java?
151+
## Q. Explain Adapter Design Pattern in Java?
153152
Adapter design pattern is one of the structural design pattern and its used so that two unrelated interfaces can work together. The object that joins these unrelated interface is called an Adapter.
154153

155154
Example:
@@ -232,7 +231,7 @@ public class Main {
232231
<b><a href="#">↥ back to top</a></b>
233232
</div>
234233

235-
#### Q. Explain Factory Design Pattern in Java?
234+
## Q. Explain Factory Design Pattern in Java?
236235
A Factory Pattern or Factory Method Pattern says that just define an interface or abstract class for creating an object but let the subclasses decide which class to instantiate. In other words, subclasses are responsible to create the instance of the class.
237236

238237
Example: Calculate Electricity Bill
@@ -330,7 +329,7 @@ class GenerateBill {
330329
<b><a href="#">↥ back to top</a></b>
331330
</div>
332331

333-
#### Q. Explain Strategy Design Pattern in Java?
332+
## Q. Explain Strategy Design Pattern in Java?
334333
Strategy design pattern is one of the behavioral design pattern. Strategy pattern is used when we have multiple algorithm for a specific task and client decides the actual implementation to be used at runtime.
335334

336335
Example: Simple Shopping Cart where we have two payment strategies – using Credit Card or using PayPal.

0 commit comments

Comments
 (0)