Abstract class and Final class are very different basically in their nature and usage in Java language. Both are very contrary in their functionality.
Following table gives the differences: abstract class vs final class.
Property | Abstract class | Final class |
---|---|---|
Subclassing | Should be subclassed to override the functionality of abstract methods | Can never be subclassed as final does not permit |
Method alterations | Abstract class methods functionality can be altered in subclass | Final class methods should be used as it is by other classes |
Instantiation | Cannot be instantiated | Can be instantiated |
Overriding concept | For later use, all the abstract methods should be overridden | Overriding concept does not arise as final class cannot be inherited |
Inheritance | Can be inherited | Cannot be inherited |
Abstract methods | Can contain abstract methods | Cannot contain abstract methods |
Partial implementation | A few methods can be implemented and a few cannot | All methods should have implementation |
Immutable objects | Cannot create immutable objects (infact, no objects can be created) | Immutable objects can be created (eg. String class) |
Nature | It is an incomplete class (for this reason only, designers do not allow to create objects) | It is a complete class (in the sense, all methods have complete functionality or meaning) |
Adding extra functionality | Extra functionality to the methods can be added in subclass | No extra functionality can be added and should be used as it is |
I am sure now you are clear of abstract class vs final class.
Pass your comments and suggestions on this tutorial "abstract class vs final class".
What is the difference between an abstract class and final class you have mentioned the difference however the final class column cannot be seen completely can you please send me an email for the same as soon as possible thank you.
What is the difference between an abstract class and final class you have mentioned the difference however the final class column cannot be seen completely can you please send me an email for the same as soon as possible thank you