Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class Gamma extends Beta { public void method10 { System.out.println(Gamma 1); super.method2: } public void method3 { System.out.println(Gamma 3); public class Alpha { public

image text in transcribed
image text in transcribed
image text in transcribed
public class Gamma extends Beta { public void method10 { System.out.println("Gamma 1"); super.method2: } public void method3 { System.out.println("Gamma 3"); public class Alpha { public void methodio { System.out.println("Alpha 1"); } } } public void method20 { System.out.println("Alpha 2"); } } public class Beto extends Alpha { public void method2() { System.out.println("Beta 2"); super method20; } } And assuming the following variables have been defined: public class Delta extends Beta { public void method2() { System.out.println("Delta 2"); 3 public void method30 method2); System.out.println("Delto 3"); } Alpha varl - new Gamma; Beta var2 - new Delta: Alpha var3 = new BetaO; Object vart - new Beta: Answer Inheritance Q1-Q3 below: Question 2 2 pts Select all correct answers (Hint: There are two) (Delta) var 1. method10 will cause a casting error. var1 is a Gamma object, hence it will invoke method10) from the Gamma class. (Delta) var 1. method10) will invoke method 10 from the Delta class. var1.method10) will print Alpha 1 since var1 is a Alpha reference. Question 3 2 pts Select all correct answers (Hint: There are two) (Delta)var 2.method30) will cause a casting error. (Delta)var 2. method30 print Delta 2 and Delta 3 (Gamma) var 2.method 30 will cause a casting error. (Gamma) var 2.method 30 will invoke method30) from the Gamma class

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

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions