nerdexam
Oracle

1Z0-809 · Question #151

1Z0-809 Question #151: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #151. The question stem and answer options stay visible for context.

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;

Unlock 1Z0-809 to see the answer

You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 1Z0-809 Practice