Home / MCQ Bank / Computer
Computer Inheritence Difficulty: Medium

Determine output: class A{ public void printName(){ System.out.println("Name-A"); } } class B extends A{ public void printName(){ System.out.println("Name-B"); } } class C extends A{ public void printName(){ System.out.println("Name-C"); } } public class Test{ public static void main (String[] args){ B b = new B(); C c = new C(); b = c; newPrint(b); } public static void newPrint(A a){ a.printName(); } }

Select the correct option to test your answer:

More Computer Questions

The elapsed time may be . . . . . . . . than the user time if your machine has multiple cores/processors. Which statement is used to create a trigger? In a web browser, which of the following is used to save frequently visited websites? What is the result of the following code in Java? `System.out.println(Math.min(Double.MIN_VALUE, 0.0));` It is a sign or symbol that specifies, operator, and values that produce a result