Examine the given definitions:
and the code fragment:
Which statement is true about the implementation of Object-Oriented Programming concepts in the given code?
Examine the given definitions:
and the code fragment:
Which statement is true about the implementation of Object-Oriented Programming concepts in the given code?
Polymorphism is implemented because the code creates an instance of the Game class but assigns it to a Playable interface reference (Playable p), allowing the method play() to be called at runtime. Abstraction is implemented through the Playable interface, which provides a set of operations (play and setPlayers) that must be implemented without specifying how they should be executed. Encapsulation is also implemented, as the players list in the Game class is private and is accessed or modified through the public getters and setters.
Letter A
No extends keyword, should not be inheritance. By elimination, only A left
C. Polymorphism, inheritance, and abstraction are implemented.
Answer is C