Can you have a constructor in abstract class?

Answer Posted / abdul hannan

Yes. We can have constructor in an abstract class but we can
not directly instantiate it. If the abstract class have no
argument constructor, it will automatically call by the
constructor of subclass through constructor chaining. If
abstract class have constructor with argument, then we need
to call it by super() and pass the argument in it.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is predicate in java?

560


What is purpose of find feature?

613


List out five keywords related to exception handling ?

600


What is a superclass?

928


Can a variable be local and static at the same time?

546






Why string is immutable or final in java

615


What is e in java?

543


Can we initialize the final blank variable?

584


Can we extend private class in java?

551


What is the difference between pass by reference and pass by pointer?

499


What is the difference between choice and list?

594


Is it possible to specify multiple jndi names when deploying an ejb?

558


What is the primitive type short?

581


How do you join strings in java?

528


What is ph and buffers?

521