Question: public class Parent { public void rubyDoo( ) { . . . } . . . public int x = 0; } public class Child

public class Parent

{

public void rubyDoo( )

{ . . . }

. . .

public int x = 0;

}

public class Child extends Parent

{

public void busterStein( )

{ . . . }

. . .

public int x = 39;

}

18. Is the following legal? If not, why not? Child theObj = new Child( ); Parent newObj = theObj; newObj.busterStein( );

19. Is the following legal? If not, why not? Child theObj = new Child( ); Parent newObj = theObj; newObj.rubyDoo( );

20. Is the following legal? If not, why not? Parent meatloaf = new Child( );

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!