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

Subclass Constructor Super Call

< Prev
Next >

Consider the following class declarations. Which statement best explains the error in the Banana class constructor?

public class Fruit {
    public Fruit(String type) { }
}

public class Banana extends Fruit {
    public Banana() {
        super("yellow", true);
    }
}
A

The parameter types in the Fruit constructor are incompatible with those in Banana.

B

The Banana constructor should call this() instead of super().

C

The Banana class should not extend Fruit.

D

The Banana constructor calls super with two parameters while the Fruit constructor accepts only one parameter.

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1kaisuki11 0m 00s 100
#2psak1211 0m 42s 58
#3suhanakochhar00612 1m 42s -12
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|FAQ