Abstract , Final and Static Combination in Java | Java Training Videos

This Java Training Videos “Abstract , Final and Static Combination in Java” is providing information about why we cannot combine abstract and final modifiers as well as abstract and static modifiers in java application.


 

Can an abstract class be final?

  • No,
  • Abstract class must be extended.
  • Final class cannot be extended.

 

  • A method cannot be abstract & final.
  • A method cannot be abstract & static.

 

Why abstract method cannot be static?

  • Common functionality of Object we define as static.
  • Abstract methods are specific to particular object.
  • Hence both static(common) and abstract(specific) are illegal combination.

 

Can a final class extends Abstract class?

  • Yes.
  • Extended class need to implement all the specifications of abstract class.
  • Another extension of final class is not allowed.

 

Share this