Oracle
1Z0-809 · Question #151
Given: class Animal { String type = "Canine"; int maxSpeed = 60; Animal () {} Animal(String type, int maxSpeed) { this.type = type; this.maxSpeed = maxSpeed; } } class WildAnimal extends Animal {…
The correct answer is E. Replace line n1 with: super () ; this.bounds = bounds. You've hit your session limit · resets 10:20pm (America/New_York)
Question
Given:
class Animal {
String type = "Canine";
int maxSpeed = 60;
Animal () {}
Animal(String type, int maxSpeed) {
this.type = type;
this.maxSpeed = maxSpeed;
}
}
class WildAnimal extends Animal {
String bounds;
WildAnimal (String bounds) {
//line n1
}
WildAnimal(String type, int maxSpeed, String bounds) {
//line n2
}
}
And given the code fragment:
- WildAnimal wolf = new WildAnimal("Long");
- WildAnimal tiger = new WildAnimal("Feline", 80, "Short");
- wolf.type = "Canine"; wolf.maxSpeed = 60; wolf.bounds = "Long";
- System.out.println("Canine " + wolf.maxSpeed + " " + wolf.bounds);
- System.out.println("Feline " + tiger.maxSpeed + " " + tiger.bounds);
Options
- AReplace line n2 with: super (type, maxSpeed); this.bounds = bounds;
- BReplace line n2 with: super (type,maxSpeed) ; this.bounds();
- CReplace line n1 with: this.bounds = bounds; super ();
- DReplace line n1 with: this ("Canine",60) ; this.bounds = bounds;
- EReplace line n1 with: super () ; this.bounds = bounds;
How the community answered
(31 responses)- A6% (2)
- B3% (1)
- C3% (1)
- D10% (3)
- E77% (24)
Explanation
You've hit your session limit · resets 10:20pm (America/New_York)
Community Discussion
No community discussion yet for this question.