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

How many types of parsers are there?

536


What is time complexity algorithm?

540


Can we override constructor in java?

566


How do you compare arrays in java?

492


What is a null check?

531






What is your platform?s default character encoding and how to know this?

1744


What technique can be employed to compare two strings?

565


What is the difference between Error, defect,fault, failure and mistake?

650


what is the purpose of the runtime class?

547


Which is the class in java?

510


When is an object subject to garbage collection?

567


Is java call by reference?

523


What is scope of a variable?

594


what is a green thread? : Java thread

565


What is the difference between interface & abstract class?

551