Which two statements concerning the OO concepts "is-a" and "has-a" are true?

Given:

Which two statements concerning the OO concepts “is-a” and “has-a” are true?

Given:

Which two statements concerning the OO concepts “is-a” and “has-a” are true?

A.
Flimmer is-a Glommer.

B.
Flommer has-a String.

C.
Taggethas-a Glommer.

D.
Flimmer is-a ArrayList.

E.
Taggethas-a doStuff()

F.
Taggetis-a Glommer.

Explanation:
B: The relationship modeled by composition is often referred to as the “has-a” relationship. Here Flommer has-a String.
E: Thehas-a relationship has anencapsulation feature (like private or protected modifier used before each member field or method).
Here Tagget has-a method doStuff()
F: TaggetimplementsGlommer.
Taggetis-aGlommer.

Note: Thehas-a relationship has anencapsulation feature (like private or protected modifier used before each member field or method).



Leave a Reply 4

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


Ray

Ray

B E F

gelete

gelete

E: False

OCA/OCP Java SE7 Programmer I and II Study Guide (Kathy Sierra and Bert Bates)

542 Chapter 10: Advanced OO and Design Patterns
IS-A and HAS-A (OCP Objectives 3.3 and 3.4)
HAS-A happens when a class has instance variables of a class.

546 Chapter 10: Advanced OO and Design Patterns
Object Composition Principles (OCP Objective 3.4)
Object composition refers to one object having another as an instance variable (HAS-A).