1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Mazyrski [523]
3 years ago
15

Write 3 classes with three levels of hierarchy: Base, Derive (child of base), and D1 (child of Derive class). Within each class,

create a "no-arg" method with the same signature (for example void m1( ) ). Each of this method (void m1( ) ) displays the origin of the Class type. Write the TestDynamicBinding Class: (the one with the ‘psvm’ ( public static void main (String[] args)) to display the following. You are NOT allowed to use the "standard object.m1() "to display the message in the main(…) method. That would NOT be polymorphic! (minus 10 points for not using polymorphic method) Explain why your solution demonstrates the dynamic binding behavior
Engineering
1 answer:
PIT_PIT [208]3 years ago
6 0

Answer:

class Base

{

void m1()

{

System.out.println("Origin: Base Class");

}

}

class Derive extends Base

{

void m1()

{

System.out.println("Origin: Derived Class");

}

}

class D1 extends Derive

{

void m1()

{

System.out.println("Origin: D1 - Child of Derive Class");

}

}

class TestDynamicBinding

{

public static void main(String args[])

{

Base base = new Base(); // object of Base class

Derive derive = new Derive(); // object of Derive class

D1 d1 = new D1(); // object of D1 class

 

Base reference; // Reference of type Base

reference = base; // reference referring to the object of Base class

reference.m1();   //call made to Base Class m1 method

 

reference = derive;   // reference referring to the object of Derive class

reference.m1(); //call made to Derive Class m1 method

 

reference = d1;    // reference referring to the object of D1 class

reference.m1(); //call made to D1 Class m1 method

}

}

Explanation:

The solution demonstrates dynamic binding behavior because the linking procedure used calls overwritten method m1() is made at run time rather than doing it at the compile time. The code to be executed for this specific procedural call is also known at run time only.

You might be interested in
What is 39483048^349374*3948048/3i4u4
Verizon [17]

Answer:

1.  3.81813506×10^2^9

2.  1.71479428×10^6^5

3.  9.38483383×10^2^6

4.  1.150847×10^2^9

Explanation:

Feel free to give brainliest

Have a great day!

3 0
2 years ago
we wish to send at a rate of 10Mbits/s over a passband channel. Assuming that an excess bandwidth of 50% is used, how much bandw
gayaneshka [121]

Answer:

QPSK: 7.5 MHz

64-QAM:2.5 MHz

64-Walsh-Hadamard: 160 MHz

Explanation:

See attached picture.

6 0
3 years ago
A 2-bit positive-edge triggered register has data inputs d1, d0, clock input clk, and outputs q1, q0. Data inputs d1d0 are 01 an
ale4655 [162]

Answer:

  q1q1 ⇒ 01

Explanation:

The outputs of a positive edge triggered register will match the inputs after a rising clock edge.

  q1q1 ⇒ 01 . . . . matching d1d0 = 01

7 0
2 years ago
How do you make a robotic dog
fredd [130]
In order to create a robotic dog, you are needing the necessary parts to create Goddard from Jimmy nutreon boy genius
7 0
3 years ago
Read 2 more answers
have you ever heard the myth that a penny dropped off the empire state building can be dangerous? the penny would be traveling v
Yuri [45]

Answer: yes

Explanation: ontop of a tall building, you drop a small peace of metal covered in zinc. it is possible to be very dangerus because of gravity. some one walking on the side walk who gets hit in the head can get a concusion maybe even a brain injury.

7 0
3 years ago
Other questions:
  • Some cars have an FCW, which stands for
    13·1 answer
  • Define various optical properties of engineering materials
    11·1 answer
  • Your class has designed a self-cleaning reptile tank. What kind of patent would you apply for? A. a plant patent B. a design pat
    14·2 answers
  • The Review_c object has a lookup relationship up to the Job_Application_c object. The job_Application_c object has a master-deta
    7·1 answer
  • A signal containing both a 5k Hz and a 10k Hz component is passed through a low-pass filter with a cutoff frequency of 4k Hz. Wh
    9·1 answer
  • Which permission do you need to shoot on the owner’s property?
    8·1 answer
  • How did engineers help to create a ceiling fan
    8·1 answer
  • Why is there an Engineering Process?
    15·2 answers
  • Deviations from the engineering drawing cannot be made without the approval of the
    15·2 answers
  • Why is electricity considered a secondary source of energy
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!