Java OCA OCP Practice Question 1286

Question

Which of the following modifiers can be applied to an abstract method?

  • A. final
  • B. private
  • C. default
  • D. protected


D.

Note

An abstract method cannot include the final or private method.

If a class contained either of these modifiers, then no concrete subclass would ever be able to override them with an implementation.

Options A and B are incorrect.

Option C is also incorrect because the default keyword applies to concrete interface methods, not abstract methods.

Option D is correct.

The protected, package-private, and public access modifiers can each be applied to abstract methods.




PreviousNext

Related