Type Here to Get Search Results !

What does it mean when a method is declared as abstract?

0

 What does it mean when a method is declared as abstract?

A) It can have a default implementation.
B) It must be defined in the same class.
C) It cannot be called directly and must be implemented by subclasses.
D) It is a static method.

Answer: C) It cannot be called directly and must be implemented by subclasses.

Explanation: An abstract method is a method declared without an implementation. This means it cannot be called directly and must be overridden in a derived class. Abstract methods are used in abstract classes to enforce that certain methods are implemented in any subclass, thereby defining a common interface while allowing for flexibility in implementation.

Post a Comment

0 Comments