What is an abstract method?

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

What is an abstract method?

Explanation:
Abstract methods declare the method signature without providing an implementation. They establish a contract that subclasses must fulfill by supplying concrete code for that method. The containing class is usually declared abstract, and you can’t instantiate it until all abstract methods are implemented by a subclass. This is why the best description is a method that is declared with the abstract keyword and has no body. If a method has an empty body, it’s still a concrete method with a (potentially no-op) implementation, not abstract. A static method belongs to the class itself and can have an implementation, and a method with default implementation is simply a regular, concrete method.

Abstract methods declare the method signature without providing an implementation. They establish a contract that subclasses must fulfill by supplying concrete code for that method. The containing class is usually declared abstract, and you can’t instantiate it until all abstract methods are implemented by a subclass. This is why the best description is a method that is declared with the abstract keyword and has no body. If a method has an empty body, it’s still a concrete method with a (potentially no-op) implementation, not abstract. A static method belongs to the class itself and can have an implementation, and a method with default implementation is simply a regular, concrete method.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy