UIS) Answer questions on ons based on the following Java program: class A AO Sys
ID: 3721402 • Letter: U
Question
UIS) Answer questions on ons based on the following Java program: class A AO System. out.println("A.f (B)"); t System.out.println ("A.g(A)") cvoid R) f System.out.println("A.f (A)"); public void g(A a) E class B extends A public void f(A a) public void f (B b) public void g(B b) ln("B.f (A)"); { System . out . printin ("B. f (B)"); { System . out .printin ( "?.g(B)"); System.out.prin } } A a new A() ; B b new BO; A ab new BO; What is the result for each of the following method calls? . af(a); . a.f(ab); . b.f(ab); . ab.f(a); . ab.f(ab); . ab.g(ab);Explanation / Answer
OutPut:
a.f(a); = A.f(A)
a.f(ab); = A.f(A)
b.f(ab); = B.f(A)
ab.f(a); = B.f(A)
ab.f(ab); = B.f(A)
ab.g(ab); = A.g(A)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.