Java OCA OCP Practice Question 1275

Question

Fill in the blanks:

Excluding default and static methods,

a(n) ___ can contain both abstract and concrete methods,

while a(n) ___ contains only abstract methods.

  • A. concrete class, abstract class
  • B. concrete class, interface
  • C. interface, abstract class
  • D. abstract class, interface


D.

Note

An abstract class can contain both abstract and concrete methods, while an interface can only contain abstract methods.

With Java 8, interfaces can now have static and default methods, but the question specifically excludes them, making Option D the correct answer.

The concrete classes cannot contain any abstract methods.




PreviousNext

Related