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
If a 1500 V load is ac coupled to the output in Figure 9–60, what is the resulting output voltage (rms) when a 50 mV rms input i
Vilka [71]

The resulting output voltage (rms) when a 50 mV rms input applied is  -187.5 mV.

<h3>What is rms voltage?</h3>

Root Mean Square Voltage is the amount of AC power which produces the same heating effect as DC Power would have produced.

Vo = -gm x Vi (Rd II Rl )

Vo = -5000 x  10⁻⁶ x 50 x 10⁻³ x (1.5k II 1.5k )

Vo = -25 x 10⁻² x 750 x  10⁻³

Vo = -187.5 mV

Hence, resulting output voltage (rms) when a 50 mV rms input applied is   -187.5 mV.

Learn more about rms voltage.

brainly.com/question/13507291

#SPJ1

4 0
2 years ago
A ball slowly starts to roll downhill, but its speed increases as it rolls. How are the ball's speed and energy related? - Why d
netineya [11]

Answer:

the ball gains speed because of the force of the earth pulling on it and the kinetic energy coming ffrom the potental energy

Explanation:

7 0
4 years ago
How would you describe what would happen to methane if the primary bonds were to break?
erastova [34]

Answer:

All the bonds in methane (CH4CH4) are equivalent, and all have the same dissociation energy.

The product of the dissociation is methyl radical (CH3CH3). All the bonds in methyl radical are equivalent, and all have the same dissociation energy.

The product of that dissociation is methylene (CH2CH2). All the bonds in methylene are equivalent, and all have the same dissociation energy.

The product of that dissociation is methyne (CHCH) .

The C-H bonds in methane do not have the same dissociation energy as C-H bonds in methyl radical, which in turn do not have the same dissociation energy as the C-H bonds in methylene, which are again different from the C-H bond in methyne.

If (by some miracle) you were able to get all four bonds in methane to dissociate absolutely simultaneously, they would all show the same dissociation energy… but that energy, per bond broken, would be different than the energy required to break just one C-H bond in methane, because the products are different.

(In this case, it’s CH4→C+4HCH4→C+4H versus CH4→CH3+HCH4→CH3+H.)

To alter hydrocarbons you add enough energy to break a C-H bond. Why does only one bond break? What concentrates the energy on one C-H bond?

the weakest CH bond is the one that breaks. in plain alkanes it has to do with the molecular orbital interactions between neighboring carbon atoms. look at propane for example. the middle carbon has two C-C bonds, and each of those C-C bonds is strengthened by slight electron delocalization from the C-H bonds overlapping with the antibonding orbitals of the adjacent carbons.

since the C-H bonds on the middle carbon donate electron density to both of its neighbors, those two are weakest.

one of them will break preferentially.

which one actually breaks depends on the reaction conditions (kinetics). frankly it's whichever one ramdomly approaches a nucleophile first. when the nucleophile pulls of one of the H's, the other C-H bonds start to share (delocalize) the negative charge across the whole molecule. so while the middle C feels the majority of the negative charge character, the other two C's take on a fair amount as well...

by the way, alkanes don't really like to break and form anions like that.

a better example would be something like isopropyl iodide, where the C-I bond breaks and the I carries away the electron pair, forming a carbocation (also not particularly stable, but more so than the carbanion).

7 0
3 years ago
What are materials engineers trying to discover when they study different materials?
coldgirl [10]
What do materials science and engineering graduates do?
Almost two-thirds of materials science graduates are in employment six months after graduation.

The skills developed during a materials science degree allow graduates enter a range of sectors, including working as engineering professionals and in design and marketing roles.

Destination Percentage
Employed 60.4
Further study 24.5
Working and studying 5.1
Unemployed 4
Other 6.1
Graduate destinations for materials science and engineering
Type of work Percentage
Engineering and building 23.9
Marketing, PR and sales 11.9
Business, HR and financial 11.7
Technicians and other professionals 10
Other 42.5
5 0
3 years ago
Read 2 more answers
In a Series circuit with two identical loads, the voltage across each load will be:
mel-nik [20]
<h3>Option A</h3>

In a Series circuit with two identical loads, the voltage across each load will be:  the same

<h3><u>Explanation:</u></h3>

A series circuit is one with total the loads in a row. There is barely ONE path for electricity to pass. If this circuit was a series of flashbulbs, and one left out, the left bulbs would switch off. T

he current in a series circuit is universally the same and the voltage over the circuit is the amount of the unique voltage drops over each component. The voltage referred to as a series circuit is equivalent to the amount of the individual voltage drops.

8 0
3 years ago
Other questions:
  • A rectification column is fed 100 kg mol/h of a mixture of 50 mol % benzene and 50 mol % toluene at 101.32 kPa abs pressure. The
    5·1 answer
  • You are given the following information about a drybatch paving operation. You are going to use one mixer that has a service rat
    10·1 answer
  • A 31.5 % hydrochloric acid solution is pumped from one storage tank to another. The power input to the pump is 2 kW and is 50% e
    12·2 answers
  • 5.You are designing the fit for two bearings. For each case, specify the maximum and minimum hole and shaft diameter:a.A journal
    12·1 answer
  • Tell me a riddle and whoevers i like best gets brainliest
    6·1 answer
  • Before charging a system that has been opened for service
    11·1 answer
  • One year, Boulder receives an unusually high amount of rain during the spring months. How might this event affect the likelihood
    15·1 answer
  • The two major forces opposing the motion of a vehicle moving on a level road are the rolling resistance of the tires, Fr, and th
    7·1 answer
  • What is the equation for photosynthesis​
    12·2 answers
  • A Jackhammer uses pressurized gas to transmit force to the hammer bit. What type of mechanical system is it?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!