Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
DIP Solution Part 2
public class D_DependencyInversionSolution {
private static class AuthenticateLogin {
private final Authentication authentication;
private AuthenticateLogin(Authentication authentication) {
this.authentication = authentication;
public boolean login(User user){
return authentication.login(user);
public static void main(String[] args) {
User user = new User("", "123");
AuthenticateLogin authenticateLogin = new AuthenticateLogin(new AuthenticationLinkedin());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment