Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions