Which of the following statement(s) with regard to an abstract class in JAVA…

2017

Which of the following statement(s) with regard to an abstract class in JAVA is/are TRUE ?

I. An abstract class is one that is not used to create objects.

II. An abstract class is designed only to act as a base class to be inherited by other classes.

  1. A.

    Only I

  2. B.

    Only II

  3. C.

    Neither I nor II

  4. D.

    Both I and II

Attempted by 182 students.

Show answer & explanation

Correct answer: D

Answer: Both statements are true.

  • Statement I: An abstract class cannot be directly instantiated. You cannot create objects of an abstract class using new. (It can have a constructor, but that constructor is used when a concrete subclass is created.)

  • Statement II: An abstract class is intended to serve as a base class to be inherited by other classes. It can declare abstract methods that subclasses must implement and also provide concrete methods and fields to share common behavior.

  • Key nuance: Both statements are true, but remember that abstract classes are not limited to only declaring abstract methods—they can include implemented methods, fields, and constructors used by subclasses.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor