Question
JAVA Given the following definition of the classes A, B and C class A { private int a; public A() {a = 1;} public A(int
JAVA
Given the following definition of the classes A, B and C
class A {
private int a;
public A() {a = 1;}
public A(int a) { this.a = a;}
public int f( int x) {return a*x;}
}
class B extends A{
private int b;
public B(){ b = 2; super(2);}
public B(int b) {this.b = b; super(b);}
public int f( int x) {return a*b*x;}
}
class C extends B{
private int c;
public C() {c = 3; super(3);}
public int f( int x) {return a*b*c*x;}
}
provide an object diagram (just show the data members and their values) for each of the following objects m, n, and o:
A m = new A(5);
B n = new B(4);
C o = new C();
You can draw your memory diagram on a piece of paper
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