Subclass Constructor Initialization
Consider the following class definitions.
public class Club
{
private ArrayList<String> members;
public Club() { }
public Club(ArrayList<String> theMembers) {
members = theMembers;
}
/* Additional implementation not shown */
}
public class SchoolClub extends Club
{
private String advisor;
public SchoolClub(String theAdvisor, ArrayList<String> theMembers)
{
/* missing code */
}
/* Additional implementation not shown */
}
Which of the following code segments can replace /* missing code */ in the SchoolClub constructor so that all instance variables are correctly initialized?
A
super(theMembers); advisor = theAdvisor;
B
advisor = theAdvisor;
C
super(new Club(theMembers)); advisor = theAdvisor;
D
super(theMembers);
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #2 | psak12 | 0 | 1 | 1m 17s | -87 |
| #3 | suhanakochhar006 | 1 | 1 | 5m 47s | -247 |
Items per page:
10
1 – 3 of 3
APFIVE