Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please Solve this by Java Question 6 (30 points) - BMY Guest Assume you have the following code, with each class in its own file.
Please Solve this by Java
Question 6 (30 points) - BMY Guest Assume you have the following code, with each class in its own file. public class M extends Y { private String ml = "ml"; protected String m2 = "m2"; public M() { super("cat"); System.out.println("In M 1"); } public M(String var) { System.out.println("In M 2 (" + var + ")"); } public String getM1 () { return ml; } public String getM2 () { return m2; } public void foo () { System.out.println("foo in M"); } public void part_g() { // Fill in this method for part g } } public class Y extends B { private String yl = "y1"; protected String y2 = "y2"; public Y() { System.out.println("In Y 1"); } public Y (String var) { System.out.println("In Y 2 (" + var + ")"); } public String getY1 () { return yl; } public String getY2() { return y2; } public void foo() { System.out.println("foo in Y"); super.foo(); } public void foo (int v) { System.out.println("foo in Y (" + v + ")"); } public class B { private String b = "bl"; protected String b2 = "b2"; public B() { System.out.println("In B 1"); } public B (String var) { System.out.println("In B 2 (" + var + ")"); } public String getB1 () { return bl; } public String getB2 () { return b2; } public void foo() { System.out.println("foo in B"); } public void foo (int v) { System.out.println("foo in B (" + v + ")"); } For parts a-f below, write what will output from the given line of code. For parts g and h, follow the instructions writing the code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started