7. [12 Points] Object Oriented Programming a. Assume the following classes have
ID: 3728586 • Letter: 7
Question
7. [12 Points] Object Oriented Programming a. Assume the following classes have been defined: pubiic ciass C public String tostring) public void method1) public void method2) ( return "c" System.out.println("c 1") . System.out.println("c 2")i public class B extends C public String toString) return "b public void method2) f System.out.println("b 2") public class A extends B t public void method2) ( System.out.println ("a 2") public class D extends B f public void method1) ( System.out.printiln("d 1") Consider the code below that uses these classes. Predict the output from the for loop. public static void main (Stringtl args)t C[] elements = {new A(), new B(), new C ( ), new D()}; for (int i = 0; iExplanation / Answer
Output of the above Program:
b
c 1
a 2
b
c 1
b 2
c
c 1
c 2
b
d 1
b 2
______________Thank You
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.