Difference between static, final and abstract class in java

1 min


0
2 shares

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.



Like it? Share with your friends!

0
2 shares

What's Your Reaction?

LIKE LIKE
1
LIKE
DISLIKE DISLIKE
0
DISLIKE
DAMN DAMN
0
DAMN
CUTE CUTE
0
CUTE
OMG OMG
0
OMG
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.

0 Comments

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.