Java OCA OCP Practice Question 2095

Question

Choose the correct answer based on the following class definition:.

public abstract final class Shape { }
  • A. Compiler error: a class must not be empty
  • B. Compiler error: illegal combination of modifiers abstract and final
  • C. Compiler error: an abstract class must declare at least one abstract method
  • D. no compiler error: this class definition is fine and will compile successfully


B.

Note

You cannot declare an abstract class final since an abstract class must to be extended.

Class can be empty in Java, including abstract classes.

An abstract class can declare zero or more abstract methods.




PreviousNext

Related