Can An Abstract Class Be Final
For abstract classes compolsory we should create child class to provide implementation , Butfinal classes we cann't create child class hence abstract-final combination is Illigal for classes....
final classes cann't contain abstract methods,where as abstract class can contain final methods....
abstract methods should be overridden in child classes to provide Implementation where as final methods cannot be overridden,hence abstract final combination is illigal for methods...
abstract classese contains methods with no definition(abstract methods). These methods are to be implemented by a class which extends this abstract class. However final classes cannot be inherited. Hence a class cannot be both final and abstract.
If you declare a class as final you can not extend that class.
Java compiler slaps you if you declare abstract class as final. Infact no one in this world needs both applied at a time. let me explain.
Abstract class means it contains either abstract methods or not but if you declare a class as abstarct you can not create objects for that class.
If you declare a class as final you can extend that class. so if you declare both at a time then no use of that class. thats why java wont allow both at a time.
An abstract class may not be declared as final.
2009-2016 downloadmela.com. All rights reserved.