Question: Given the following three classes, which are all defined in the same file. class A { private int x = 0; public void m()

Given the following three classes, which are all defined in the same

Given the following three classes, which are all defined in the same file. class A { private int x = 0; public void m() { x = 1; } class B extends A { private int y = 0; @Override } public void m()) { y = 2; } class C extends A { private int z = 0; @Override public void m() { z = 3; super.m(): And, the following code fragment. A al = new B(): A a2 = new CO: al.m(): a2.m(): What is the value of x after calling a1.m()? What is the value of x after calling a2.m ()?

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!