Question: Consider this code: class A { public A ( ) { } public void f ( ) { System.out.println ( in A ' s

Consider this code:
class A{
public A(){}
public void f(){
System.out.println("in A's f");
return;}
public void h(int i){
System.out.println("in A's h, i="+ i);
return;}
public void s(double d){
System.out.println("in A's s, d="+ d);
return;}
class B extends A{
public B(){}
public void f(){
System.out.println("in B's f");
return;}
public void h(int i){
System.out.println("in B's h, i="+ i);
return;}
public void s(int j){
System.out.println("in B's s, j="+ j);
return;}
}
class C extends A{
public C(){}
public void f()
{
System.out.println("in C's f");
return
}
}
The following code is in the main method:
A a1= new B();
A a2= new C();
B b = new );
A a = new A();
From the following select all correct answers (yes, there is more than one correct answer)
Select one or more:
a. The line a.) calls method f defined in A
b. The line a2.) calls the method f defined in B
c. The line a2.h(1) calls method h defined in B
d. The line a2.h(1) calls method h defined in A
Consider this code: class A { public A ( ) { }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!