Constructors in abstract classes Java [duplicated]

0

my question is:

What is the purpose of having constructors in the abstract classes if the daughter classes can not instantiate it?

Greetings.

    
asked by Fernando Jimenez 11.01.2018 в 07:33
source

1 answer

0

In an abstract class, the constructor that is in a subclass can call the constructor. An answer in StackOverflow (English) has an example.

Why? To impose restrictions on subclasses and that was the decision of Java designers. Please note that subclasses are not required to call the constructor, but it is possible to be convenient.

    
answered by 11.01.2018 в 08:05