Prev Next

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.

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

Enum

Comments & Discussions