Home / MCQ Bank / Computer
Computer Inheritence Difficulty: Medium

What is the result of the following code snippet? class Parent { int x = 10; } class Child extends Parent { int x = 20; void display() { System.out.println(super.x + " " + x); } } public class Main { public static void main(String[] args) { Child obj = new Child(); obj.display(); } }

Select the correct option to test your answer:

More Computer Questions

Which property of a Form in a Windows Forms Application is used to specify the title displayed in the form's title bar? Accessing data from which of these is faster? memory, disk Size of float and double in Java is In advanced MapReduce, what is the significance of the Hadoop MapReduce "Map-side Join"? What will be the output of the following C++ function? int main() { register int i = 1; int *ptr = &i; cout << *ptr; return 0; }