Which of the following is a valid constructor header for the Player class that accepts the player name as a parameter? public void Player(String playerName) private Player(playerName) private void Player(playerName) public Player(String playerName)

Respuesta :

Answer: Player(String playerName)

Explanation:

A constructor is a code block of a class. It is always witnessed when a new instance of the class is created

In JAVA , a valid constructor header is given as " CLASS (parameter)"

here, Class  → Player

parameter →  player name  (which is a string)

So, a valid constructor header for the Player class that accepts the player name as a parameter: Player(String playerName)

ACCESS MORE