Question: Consider the following classes. You are only being shown the methods necessary for the problem -- you may assume each class has the appropriate constructors,

Consider the following classes. You are only being shown the methods necessary for the problem -- you may assume each class has the appropriate constructors, etc. Consider the following classes: public class Blue extends Green { public void one() { System.out.println("Blue 1): super one(): } } public class Red extends Yellow { public void one() { super.one(): System.out.println("Red 1"): } public void two() { System.out.println("Red 2"): super.two(): } } public class Yellow extends Blue { public void two() { System.out.println ("Yellow 2"): } public void three() { two(): System.out.println("Yellow 3"): } } public class Green { public void one() { System.out.println("Green 1"): } public void threee() { System.out.println("Green 3"): } } //Suppose the following variables are defined: Green var l = new Blue(): Green var2 = new Red(): Blue var3 = new Yellow(): Object var4 = new Green(): Indicate on each line below the output produced by each statement shown. If the statement produces more than one line of output indicate the line breaks with slashes as in a/b/c to indicate three lines of output with a followed by b followed by c. If the statement causes an error, write the word error to indicate this. Indicate the output produced by each statement shown. If the statement produces more than one line of output indicate the line breaks with slashes as in a/b/c to indicate three lines of output with a followed by b followed by c. If the statement causes an error, write the word error to indicate this. a) var1.one(): b) var1.two(): c) var1.three(): d) var2.one(): e) var2.three(): f) var3.one(): g) var3.two(): h) var3.three(): i) var4.one()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
