Home / MCQ Bank / Computer
Computer Inheritence

What will be the output of the following Java program? class A { int i; } class B extends A { int j; void display() { super.i = j + 1; System.out.println(j + " " + i); } } class inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • 2 3

Related Computer Questions

Which of these methods of class String is used to compare two String objects for their equality? What is the purpose of a test suite in Ruby testing? What is the keyword used to define a conditional statement in Ruby? What is the scope of an external variable? What is the purpose of the 'std::async' function in C++ multi-threading?