Can an abstract class have a constructor in Java?

  • It depends on the class
  • No
  • Yes, always
  • Yes, but with restrictions
Yes, an abstract class can have a constructor in Java. However, there are some restrictions. The constructor of an abstract class is typically used to initialize the fields of the abstract class, and it can be called from subclasses using the super keyword.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *