In Chapter 6, we have looked at the keyword
final, let us now look at another keyword in Java called
abstract. The keyword
abstract in a sense is opposite of
final. It is a modifier only for methods and classes. The modifiers
final cannot be used together. A method or a class cannot be declared to be both
final method prevents overriding, whereas an
abstract method promotes overriding. A
final class prevents inheritance, whereas an
abstract class promotes inheritance.
What is the meaning of declaring a method as
abstract. When we declare a method as
abstract, then we do not provide an implementation of the method, and the method ...