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

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