Abstraction Interview Questions

    Question 1: JAVA OOPS - Abstract Class Basics

    Which of the following statements about abstract classes is true?

    Question 2: JAVA OOPS - Abstract Method Implementation

    What will happen when we run the following code?

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

    Question 3: JAVA OOPS - Abstract Class Constructor

    Which statement is true about constructors in abstract classes?

    Question 4: JAVA OOPS - Multiple Abstract Classes

    Which statement is correct?

    Question 5: JAVA OOPS - Interface vs Abstract Class

    Which is true about interface and abstract class?

    Question 6: JAVA OOPS - Abstract Class Reference

    What will be printed?

    abstract class A { abstract void show(); void display() { System.out.println("Display"); } } class B extends A { void show() { System.out.println("Show"); } } public class Main { public static void main(String[] args) { A obj = new B(); obj.display(); } }

    Question 7: JAVA OOPS - Abstract Method Requirement

    Which of the following is true?

    Question 8: JAVA OOPS - Interface Implementation

    What will happen with the following code?

    interface A { void show(); } class B implements A { public void show() { System.out.println("Hello"); } } public class Main { public static void main(String[] args) { A obj = new B(); obj.show(); } }

    Question 9: JAVA OOPS - Abstract Class with Main Method

    Which is correct?

    Question 10: JAVA OOPS - Purpose of Abstraction

    What is the main purpose of abstraction in Java?