If a class has at least one abstract method, the class must be?

Prepare for the Object-Oriented Programming Test with flashcards and multiple choice questions. Each question comes with hints and explanations to enhance understanding. Master OOP concepts and succeed in your exam!

Multiple Choice

If a class has at least one abstract method, the class must be?

Explanation:
When a class includes at least one abstract method, it must be declared abstract. An abstract method has no implementation, so the class isn’t complete on its own and cannot be instantiated. Declaring the class as abstract communicates that subclasses will provide concrete implementations for the abstract methods, while the abstract class can still offer implemented methods to share common behavior. This is exactly why the correct option specifies the class as abstract. Think of interfaces as a different construct used to define a contract; a class with an abstract method is not an interface. A final class cannot be abstract because final prevents subclassing, and abstract methods require subclassing to provide implementations. Static relates to members or nested classes, not to whether a class must be abstract.

When a class includes at least one abstract method, it must be declared abstract. An abstract method has no implementation, so the class isn’t complete on its own and cannot be instantiated. Declaring the class as abstract communicates that subclasses will provide concrete implementations for the abstract methods, while the abstract class can still offer implemented methods to share common behavior. This is exactly why the correct option specifies the class as abstract.

Think of interfaces as a different construct used to define a contract; a class with an abstract method is not an interface. A final class cannot be abstract because final prevents subclassing, and abstract methods require subclassing to provide implementations. Static relates to members or nested classes, not to whether a class must be abstract.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy