Build a UML inheritance diagram with the following information: Consider the cla
ID: 3815037 • Letter: B
Question
Build a UML inheritance diagram with the following information: Consider the classes shown below: public class Parent {public void doSomethingO {/middot Implementation not shown middot/} public class Child extends Parent public void doAnotherThing() {/middot Implementation not shown middot/}} Which lines in the following code will compile without error? Explain your answer. Child kid -newChild(); kid.doSomething();//line 1 kid.doAnotherThing();//line 2 Line 1 only Line 2 only Lines 1 and 2 Neither line will compile without errorExplanation / Answer
Q8.
Vehicle
|
|
--------------------------------------------------------------------------
| | |
AirVehicle LandVehicle WaterVehicle
|
Auto
Q9)
Child kid = new Child();
kid.doSomething(); //line 1
kid.doAnotherThing(); // line
As, Child is inheriting all public members of Parent class, so
doSomething method is also available for child object
Ans: c)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.