why abstract class will have a constructor?

Answer Posted / aditya ganjiwale

Its there to be able to initialize the abstract class
internal state.
Lets say you would like to assign two variables, you would
have to do this for every implementation, but with
constructors in the abstract class you only need it once:
So every class inheriting only needs to call the
constructor, instead of assigning the values themself every
time.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we override static methods in java?

591


Do loops java?

560


List implementations of list interface?

569


What is variable and example?

525


What is multithreading in java?

563






What is unmodifiable collection in java?

521


What are the 7 types of characters?

574


How do you check if two strings are equal in java?

593


What is the exception hierarchy in java?

492


What are the benefits of operations?

522


What are the main concepts of oops in java?

602


Explain listiterator and methods in listiterator?

555


Does treeset use compareto?

545


How many return statement are allowed in a function?

465


What is hash table in java?

496