| preferred AP College board partner for AP classes
AP Computer Science A/Unit 9: Inheritance
Start Practice TestPractice Test
About Exam
easy Solved by 5 students
Subclass Constructor Initialization
< Prev
Next >

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);

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1kaisuki11 0m 00s 100
#2psak1201 1m 17s -87
#3suhanakochhar00611 5m 47s -247
Items per page:
10
1 – 3 of 3
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy