Answer:
The answer is "Option C"
Step-by-step explanation:
In the given code, a child class "player" is defined, which inherits its base class that is "Comparable". In the child class, a private variable is declared, that is "name and goalsScored", in which name is string variable and "goalsScored" is an integer variable.
In this class a method, compareTo is declared, that accepts an object as a parameter, inside the method a player class object is created, that value is held by the reference variable, and this function will return a value, and another option is wrong, that can be described as follows:
- In option A, It is wrong, because there is not a reference variable.
- Option B and Option D are wrong, because in object creation first, we use the class name, which is missing.