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 included in core java?

592


Is string is a keyword in java?

553


Can java list be null?

558


What is operator overloading. Is it is supported in java?

528


Which data type is a class in java?

583






Which class is used by server applications to obtain a port and listen for client requests?

504


Can we make main() thread as daemon?

585


Can we serialize singleton class?

544


Will the jvm load the package twice at runtime?

580


How do you compare arrays in java?

511


What does string [] args mean?

549


what is the purpose of the runtime class?

559


Why to use nested classes in java? (Or) what is the purpose of nested class in java?

534


What is gc()?

587


Explain inner classes ?

657