Difference between static, final and abstract class in java
Let me discuss static, final and abstract class one by one. 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 [...]
Let me discuss static, final and abstract class one by one.
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 article
Written by : Junaid Rehman
I am a blogger and freelance web developer by profession. I love to blog and learn new things about programming and IT World.
Follow us
Latest articles
February 14, 2025
February 14, 2025
February 14, 2025
February 14, 2025
February 14, 2025