Which represents the "program to an interface" principle?

Given:
11. interface A {
12. void someMethod();
13. }
14. class B implements A {
15. public void someMethod() { }

16. }
Which represents the “program to an interface” principle?

Given:
11. interface A {
12. void someMethod();
13. }
14. class B implements A {
15. public void someMethod() { }

16. }
Which represents the “program to an interface” principle?

A.
public B make() { return new A(); }

B.
public A make() { return new B(); }

C.
public B make() { return new B(); }

D.
public A make() { return new A(); }



Leave a Reply 0

Your email address will not be published. Required fields are marked *