Q.- Given:
interface Playable
{
public void play( );
public void setPlayers(List<Player> players);
}
class Game implements Playable
{
private List<Player> players;
public List<Player> getPlayers( ) { return players; }
public void setPlayers(List<Player> players) { this.players= players; }
public void play( ) { System.out.println("Played..."); }
}
and the code fragment:
Playable p=new Game( );
List<Player> players=new ArrayList<>( );
p.setPlayers(players);
p.play();
Which statement is true about the implementation of Object-Oriented Programming concepts in the given code?
A) Abstraction, polymorphism, and encapsulation are implemented.
B) Only polymorphism and inheritance are implemented.
C) Polymorphism, abstraction, and inheritance are implemented.
D) Only inheriatnce and encapsulation are implemented.
⧪ please give your answer in a comment section.
interface Playable
{
public void play( );
public void setPlayers(List<Player> players);
}
class Game implements Playable
{
private List<Player> players;
public List<Player> getPlayers( ) { return players; }
public void setPlayers(List<Player> players) { this.players= players; }
public void play( ) { System.out.println("Played..."); }
}
and the code fragment:
Playable p=new Game( );
List<Player> players=new ArrayList<>( );
p.setPlayers(players);
p.play();
Which statement is true about the implementation of Object-Oriented Programming concepts in the given code?
A) Abstraction, polymorphism, and encapsulation are implemented.
B) Only polymorphism and inheritance are implemented.
C) Polymorphism, abstraction, and inheritance are implemented.
D) Only inheriatnce and encapsulation are implemented.
⧪ please give your answer in a comment section.
2 Comments
B
ReplyDeleteC
ReplyDelete