Inheritance Interview Questions

    Question 1JAVA OOPS - Single Inheritance

    Which of the following is true about single inheritance in Java?

    Question 2JAVA OOPS - Multilevel Inheritance

    What will be printed?

    class A { void msg() { System.out.println("A"); } } class B extends A { void msg() { System.out.println("B"); } } class C extends B {} public class Main { public static void main(String[] args) { C obj = new C(); obj.msg(); } }

    Question 3JAVA OOPS - Hierarchical Inheritance

    Which is true about hierarchical inheritance?

    Question 4JAVA OOPS - Method Overriding in Inheritance

    What will be printed?

    class A { void show() { System.out.println("Parent"); } } class B extends A { void show() { System.out.println("Child"); } } public class Main { public static void main(String[] args) { A a = new B(); a.show(); } }

    Question 5JAVA OOPS - super Keyword

    Which statement is true about super keyword?

    Question 6JAVA OOPS - Multiple Inheritance

    Why is multiple inheritance not allowed with classes in Java?

    Question 7JAVA OOPS - Constructor Execution Order

    What will be printed?

    class A { A() { System.out.println("A"); } } class B extends A { B() { System.out.println("B"); } } public class Main { public static void main(String[] args) { B b = new B(); } }

    Question 8JAVA OOPS - Inheritance and Private Members

    Which of the following statements is true?

    Question 9JAVA OOPS - final Keyword with Inheritance

    Which statement is true?

    Question 10JAVA OOPS - Abstract Class and Inheritance

    Which is true about abstract class inheritance?