- An abstract class or method can be declared by using the keyword abstract.
- Example
abstract returntype methodname();
- All methods inside the abstract class should be declared abstract.Otherwise, the method definition should be provided for the particular method in the abstract class itself.
- Abstract class can be extended to any class by using the keyword extends.
- Example
- Abstract class is mearly like a ordinary class except that we cann't be able to create objects from it.
- When an abstract class is subclassed, the subclass should provide implementations for all of the abstract methods in its parent class. However, if it does not, the subclass must also be declared
abstract.
- We can create constructors for the abstract classes.
No comments:
Post a Comment