What are the characteristics of abstract classes in Java?
Characteristics of abstract classes in Java include:
- Abstract classes cannot be instantiated and can only be used as parent classes to implement their subclasses through inheritance.
- Abstract classes can have both abstract and non-abstract methods. Abstract methods are methods without a body, and subclasses must implement these abstract methods.
- When a subclass inherits from an abstract class, it must implement all the abstract methods within the abstract class, unless the subclass is also an abstract class.
- Abstract classes can include member variables, constructors, and regular methods.
- Abstract classes cannot be declared as final classes.
- Abstract classes can have static methods, static variables, and static code blocks.
- Abstract classes can inherit from other classes or implement interfaces, but a class can only inherit from one abstract class.
- Abstract classes can have constructors, but cannot be used to instantiate objects.