Login with  Log in with facebook
Hiring Manager? SIGN UP HERE
3

Why can't a java class be both final and abstract. 

Rishi Yadav
08/09/2011 at 11:28
3 Answers
1
0

When we declare a class as final in java, we can not inherit it any further, so the only way to use it is create it's instances/objects. On the other hand when we declare a class as abstract, we can not instanciate it, so it has to be inherited any way.

Namrata Nerlekar
08/09/2011 at 12:16

2
0

You use abstract when you want to pass the parent properties to its childrrens, its childrens.......

final do exact the opposite of that. it wont allow inheritance. Thas why both abstract and final wnot work togaether.

Atul More
08/12/2011 at 01:57

3
0

Because in Java (OOP) when you declared a class a abstract it means then it means that you can not make object of that class. It means you created this class Design Purpose.. So You must have to inherit it on another class..

 

Where as when you use final keyword so it means that this class is declared as final. It means after it you can not inherit. You can not make child of it.

 

In short.... Abstract.... You must have inherit...

Final....... you can not inherit...

 

rthur query or doubt plz conact me..

 

 Pradip Bhatt

(Mob : 09328278401)

Pradip Bhatt
08/18/2011 at 00:28

If you want to post any answer to this forum then you need to log in.
Schedule a Demo

Schedule a Demo with us

Name *
Email *
Phone *
Company *
Details