Can an abstract class be final?

Answer Posted / artavazd amirkhanyan

It's good question because of most of people can't explain why we can't have abstract final classes in Java. Most of them says "An abstract class is of no use if it cannot be extended or instantiated". Imagine class where we have 10 static methods and we want them to be final to never be overridden. Now, because of class have only static methods,we can make it abstract and because of restriction on overriding, we can make it final. So abstract final classes can be very useful in aforementioned cases. But we can't have abstract final classes in Java just stupidly because of Java do not let us. And this is one of many silly restrictions of Java.

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are abstract methods in java?

657


Is there a jre for java 11?

558


Is this valid in java ? Can we instantiate interface in java?

548


how to handle exceptions in ejb?

1879


what is heap memory?

659






What is serialversionuid?

563


What are the basics of core java?

552


Does apple use java?

497


Why is multithreading important?

498


What is the difference between interface & abstract class?

561


What is a generic type?

565


What are the different tags provided in jstl?

553


why doesn't java run on all platforms?

570


What is operator overloading. Is it is supported in java?

524


What does system.gc() and runtime.gc() methods do?

601