The correct code snippet showing a "Has-A" relationship is option B, where the Computer
class contains an instance of the Screen
class as a member variable. This composition relationship means that a Computer
has a Screen
as part of its structure. The other options either show inheritance (A and D) or implementation of an interface (C), none of which represent a "Has-A" relationship.