Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 1 students

Subclass Constructor Implementation

< Prev
Next >

Consider the following class definitions.

public class Vehicle {
    private int speed;
    public Vehicle() {
        speed = 0;
    }
    public Vehicle(int s) {
        speed = s;
    }
    // Other methods not shown
}

public class Car extends Vehicle {
    private String model;
    public Car(int s, String m) {
        /* implementation not shown */
    }
    // Other methods not shown
}

Which of the following code segments correctly implements the Car constructor?

I. super(s); this.model = m;
II. super(); speed = s; model = m;
III. super(s); model = m;

A

I and III only

B

II and III only

C

III only

D

I only

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

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

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