Question: 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


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
Get step-by-step solutions from verified subject matter experts
