Let me discuss static, final and abstract class one by one.

Abstract class

abstract class
Abstract class

An abstract class is that which must be extended. If you use abstract method in a class then that means the class is abstract also so you have to declare that class as abstract. Abstract class behaves as a template. Abstract class can contain static data. Abstract class can not be instantiated.

Static class

Static class is that whose methods and variables can be called without creating the instance of the class. Static means which is initialized once for example our main method is initialized only once.

We cannot override the static method in child class by non static. So the child class should be static as well.

Final class

Final class is that which cannot be extended and the final variable is constant that means it cannot be changed.


Share This Story, Choose Your Platform!