[General boards] [Winter 2019 courses] [Fall 2018 courses] [Summer 2018 courses] [Older or newer terms]

Abstract classes


#1

Do all abstract classes need to have a no-args constructor?


#2

No, an abstract class could require arguments in the constructor. However, all subclasses of it must call super(arg1,…argn) correctly.


#3

What if the subclass called only super() in its constructor?


#4

If there isn’t a no-argument constructor in the parent class, calling super() would not compile.

Once you write a constructor for a class, java no longer provides the empty constructor for it.

So in this case, the program would not compile.