Abstraction Interview Questions

    Question 1JAVA OOPS - Abstract Class Basics

    Which of the following statements about abstract classes is true?

    Question 2JAVA 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 3JAVA OOPS - Abstract Class Constructor

    Which statement is true about constructors in abstract classes?

    Question 4JAVA OOPS - Multiple Abstract Classes

    Which statement is correct?

    Question 5JAVA OOPS - Interface vs Abstract Class

    Which is true about interface and abstract class?

    Question 6JAVA 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 7JAVA OOPS - Abstract Method Requirement

    Which of the following is true?

    Question 8JAVA 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 9JAVA OOPS - Abstract Class with Main Method

    Which is correct?

    Question 10JAVA OOPS - Purpose of Abstraction

    What is the main purpose of abstraction in Java?