Home / MCQ Bank / Computer
Computer Operators Difficulty: Medium

What will be the output for the below code? class A{ public void printValue(){ System.out.println("A"); } } class B extends A{ public void printValue(){ System.out.println("B"); } } public class Test{ public static void main(String... args){ A b = new B(); newValue(b); } public static void newValue(A a){ if(a instanceof B){ ((B)a).printValue(); } } }

Select the correct option to test your answer:

More Computer Questions

What is true of final class? What will be the result of the following MySQL command? WHERE end_date IS NULL AND (title='teller' OR start_date < '2007-01-01') Which of the following property is used to define whether an element should be resized and, if so, upon what axis? What is the advantage of using generator expressions over list comprehensions? How many arguments will the subscript operator will take for overloading?