Home / Programming MCQs / JAVA MCQs / Question
S
Q. 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"); } } 1. public class Test{ 2. public static void main(String... args){ 3. A b = new B(); 4. newValue(b); 5. } 6. public static void newValue(A a){ 7. if(a instanceof B){ 8. ((B)a).printValue(); 9. } 10. } 11. }
No solution found for this question.
Add Solution and get +2 points.
You must be Logged in to update hint/solution
What will happen if two thread of the same priority are called to be processedsimultaneously?
How do you rewrite the below Java code snippet? int p=10; p = p%3;
When a method calls itseif, it is called __________.
Which does autoboxing or unboxing in Java?
Iterator returned by TreeSet is
What is the output of the Java code snippet?
Which object of HttpSession can be used to view and manipulate information about asession?
What is stored in the object obj in following lines of code? box obj;
Discusssion
Login to discuss.