Which of the following is the correct way to create an abstract class in Java?

2024

Which of the following is the correct way to create an abstract class in Java?

  1. A.

    class Demo { abstract void fun(); }

  2. B.

    class abstract Demo { void abstract fun(); }

  3. C.

    abstract class Demo { abstract void fun(); }

  4. D.

    abstract class Demo { void fun() { abstract; } }

  5. E.

    Question not attempted

Attempted by 88 students.

Show answer & explanation

Correct answer: C

The correct Java syntax places abstract before class, and an abstract method has no method body. Therefore the valid declaration is abstract class Demo { abstract void fun(); }.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs