Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Solve the problem on paper (Upload the image file or you can type your work and submit the doc file or use the text

Java

image text in transcribedimage text in transcribedimage text in transcribed

Solve the problem on paper (Upload the image file or you can type your work and submit the doc file or use the text window below). Show work that demonstrates how you got your answer rather than just writing the answer itself. You will not be graded on whether you have a perfect solution, but on whether you have demonstrated a reasonable effort. Practice Inheritance Problem Assuming that the following classes have been defined: public class Block extends Truck public void methodl() { System.out.println("Block 1"); } public void method3() { System.out.println("Block 3"); } ) public class Doll extends Ball { public void methodl() { System.out.println("Doll 1"); } public void method2() { System.out.println("Doll 2"); } } public class Truck extends Ball { public void method2() { System.out.println("Truck 2"); super.method2(); method3(); } public void method3() { System.out.println("Truck 3"); } } public class Ball { public void method2() { System.out.println("Ball 2"); } public void method3 () { System.out.println("Ball 3"); } } And assuming the following variables have been defined: Ball varl - new Truck(); Doll var2 = new Doll(); Ball var3 = new Block(); Object var4 new Ball(); Truck var5 = new Block(); Ball var6 = new Doll(); In the table below, indicate in the right-hand column the output produced by the statement in the left-hand column. If the statement produces more than one line of output, indicate the line breaks with slashes as in "a/b/c" to indicate three lines of output with "a" followed by "b" followed by "c". If the statement causes an error, fill in the right-hand column with either the phrase "compiler error" or "runtime error" to indicate when the error would be detected. Statement Output var1.method10); var2.method10); var1.method2(); var2.method2(); var3.method2(); var4.method2(); var5.method2(); var1.method30; var2.method3(); var3.method30); var4.method30); var5.method3(); ((Doll)var3) method10; ((Block)var5).method10); ((Truck)var3).method10); ((Truck)var3).method3(); ((Block)var6).method3(); ((Ball)var4).method2(); ((Truck)var4).method30; ((Doll)var6).method3()

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions