Answered step by step
Verified Expert Solution
Link Copied!

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

student submitted image, transcription available belowstudent submitted image, transcription available below  

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Project Management The Managerial Process

Authors: Erik W. Larson, Clifford F. Gray

7th edition

1260547272, 1259666093, 9781260547276, 978-1259666094

More Books

Students also viewed these Programming questions

Question

please try to give correct answer 4 4 3 .

Answered: 1 week ago