nerdexam
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:
  1. WildAnimal wolf = new WildAnimal("Long");
  2. WildAnimal tiger = new WildAnimal("Feline", 80, "Short");
  3. wolf.type = "Canine"; wolf.maxSpeed = 60; wolf.bounds = "Long";
  4. System.out.println("Canine " + wolf.maxSpeed + " " + wolf.bounds);
  5. System.out.println("Feline " + tiger.maxSpeed + " " + tiger.bounds);
Which two modifications enable the code to print the following output? Canine 60 Long Feline 80 Short

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)
  • A
    6% (2)
  • B
    3% (1)
  • C
    3% (1)
  • D
    10% (3)
  • E
    77% (24)

Explanation

You've hit your session limit · resets 10:20pm (America/New_York)

Community Discussion

No community discussion yet for this question.

Full 1Z0-809 Practice