Card 28 / 32: 1. class Plant { 2. String getName() { return "plant"; } 3. Plant getType() { return this; } 4. } 5. class Flower extends Plant { 6. // insert code here 7. } 8. class Tulip extends Flower { } Which statement(s), inserted at line 6, will compile? (.)
A)
Flower getType() { return this; }
B)
String getType() { return "this"; }
C)
Plant getType() { return this; }
D)
Tulip getType() { return new Tulip(); }
Answer:
A) Flower getType() { return this; }
C) Plant getType() { return this; }
D) Tulip getType() { return new Tulip(); }
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
|