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

how to handle exceptions in ejb?

2123


Define immutable object?

871


Why hashcode is used in java?

712


What is the length of a string?

770


What is data type example?

768


What differences exist between iterator and listiterator?

845


What is the difference between array list and vector in java?

760


Can we clone singleton object in java?

809


Is null function in java?

803


What is final, finally, finalize?

815


What are different data types?

800


What is methods in java?

798


Does java allow overriding static methods ?

863


Describe the syntax of multiple inheritance? When do we use such an inheritance?

860


What is method in research paper?

806