Java OCA OCP Practice Question 1311

Question

Which of the following is not an attribute common to both abstract classes and interfaces?

  • A. They both can contain static variables.
  • B. They both can contain default methods.
  • C. They both can contain static methods.
  • D. They both can contain abstract methods.


B.

Note

Abstract classes and interfaces can both contain static and abstract methods as well as static variables, but only an interface can contain default methods.

Option B is correct.




PreviousNext

Related