If we do not create a constructor for an interface default n
If we do not create a constructor for an interface, default (no args) constructor automatically will be used. True or false
An abstract class cannot have a constructor. True or False
An abstract class cannot extend another class. True or False
Solution
If we do not create a constructor for an interface, default (no args) constructor automatically will be used. True or false
Ans:False,as if this had been allowed ,it would not be useful as interface are created so that other class can implement the behaviours contained by an interface.
According to the java documentation :
An interface does not contain any constructor,not even the default constructor.
An abstract class cannot have a constructor. True or False
Ans:False
An abstract class can have the constructor which should be specified in the subclasses as abstract class does not contain default constructor.
But we can create the constructor in an abstract class.
An abstract class cannot extend another class. True or False
Ans:False
As an abstract class can extend an another abstract as well as concrete class.
Please let me know in case of any doubt,Thanks.
