Yes, we can define a parameterized constructor in an abstract class.
abstract class AbstractClassTest { AbstractClassTest(int a) { // Parameterized Constructor System.out.println("Parameterized Constructor of an abstract class a="+ x); } } public class Test extends AbstractDemo { Test() { super(20); System.out.println("Test Class Constructor"); } public static void main(String[] args) { Test obj = new Test(); } }
In the above example, we must place a super() call in the subclass constructor (Test), if not a compile-time error will occur.
Parameterized Constructor of an abstract class a=20 Test Class Constructor