Java / Abstract Class
Can an abstract class have a final concrete method?
Yes. An abstract class can have the final concrete method. See the below example.
public class AbstractClassFinalConcreteMethod { public static void main(String[] args) { Parent p = new Child(); p.parentMethod(); } } abstract class Parent { final void parentMethod() { System.out.println("Final Method in a abstract class"); } } class Child extends Parent { }
Output: Final Method in a abstract class
In the above example, the parent abstract class has a final concrete method 'parentMethod' which is allowed and also called directly from the parent reference.
More Related questions...