Question: Programming language is JAVA: interface I { void f(); } public class A implements I { public void f() { System.out.println(A);} } public class B

Programming language is JAVA:

interface I { void f(); }

public class A implements I {

public void f() {

System.out.println("A");}

}

public class B extends A {

public int n;

public void g() {

System.out.println("B");}

}

public class C extends B {

public void g() {

System.out.println("C");}

}

public class Tester {

static I varI;

public static void main(String[] a)

{

I varJ;

A varA = new A();

B varB = new B();

C varC = new C();

// new code goes here

}

}

Consider various statements to go at the end of main. Maybe the statement(s) involves an assignment, a method call, a class cast. On the e_x_a_m you'll be asked what outcome is produced when we add the statement(s). For example, if we add the statement varB = varA; there would be a compiler error because the assignment is in the wrong direction. Or if we have the statement varB = varC; followed by varB.g() what would the output be?

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 Databases Questions!