Dependency Inversion Principle in Java
Dependency Inversion Principle in Java
Dependency Inversion Principle states to “Depend on abstractions and not upon concretions”. What this principle means is that rather than writing code that refers to concrete classes, you should code for Interfaces and Abstract classes. For example, if Class B instantiates Class A, then it gets dependent on the Class A. Class A { // ... } Class B { A a = new A(); } With the above code, Class B…
View On WordPress










