Home > Software > Java > Core-Java
Interview Questions   Tutorials   Discussions   Programs   

Core-Java - How can you have a constructor in abstract class?

asked marvit September 18, 2014 01:55 AM  

How can you have a constructor in abstract class?


1 Answers

answered By Madhumathi   0  

Yes, abstract class can have constructor in Java. You can either explicitly provide constructor to abstract class or if you don't, compiler will add default constructor of no argument in abstract class. This is true for all classes and its also applies on abstract class.

An abstract class in Java, its a class which can not be instantiated with new() operator or any other ways. In order to use abstract class in Java, You need to extend it and provide a concrete class. Abstract class is commonly used to define base class for a type hierarchy with default implementation, which is applicable to all child classes.

   add comment

Your answer

Join with account you already have



Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!