Java OCA OCP Practice Question 374

Question

Which statements are true?

Choose all that apply.

  • A. Method delegation relies on IS-A relationships
  • B. Method forwarding relies on HAS-A relationships
  • C. The DAO pattern limits you to one instance of the DAO object
  • D. The singleton pattern relies on IS-A relationships
  • E. To use object composition, classes must be final


B is correct.

Note

Method forwarding is an object composition principle and calls methods on an instance variable of an object.

A is incorrect because method delegation and method forwarding are the same thing.

C is incorrect because it is the singleton pattern that limits you to one object.

D is incorrect because singleton classes typically don't have a superclass other than Object.

E is incorrect because there is no such requirement.




PreviousNext

Related