Question: 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 followingcode, with each class in its own file. public class M extends

 

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

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 Programming Questions!