Question: Given the code below, answer the following: 1. (+1) In statement 1, which Java rule allows us to use a reference of a type different

 Given the code below, answer the following: 1. (+1) In statement

Given the code below, answer the following: 1. (+1) In statement 1, which Java rule allows us to use a reference of a type different from the object type? 2. (+2) In statement 1, trace the chain of constructors being called by Chicken(50)), i.e. list all constructors from all classes that were called by this statement and indicated their order of execution and what each constructor does. Make sure to refer to how (super is used in this process. 3. (+2] In statement 2, write the expected output and explain how dynamic binding works to produce that output. public class Test { public static void main(String[] args) { Displayable d = new Chicken(50), 1/1 d.display(); 1/2 public interface Displayable{ void display(); } public abstract class Animal implements Displayable { private int x, y, public Animal(){x=0; y=0;) public Animal(int x, int y){this.x = x; this.y = y;} public class Bird extends Animal private int weight; public void display {System.out.println("Bird"); } } public class Chicken extends Bird private int energy; public Chicken(int enerey){this.energy - energy :) Edit View Insert Format Tools Table 12

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!