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

What is ternary operator? Give an example.

593


What is mean by collections in java?

562


What is exception handling in java?

571


Explain the selection sort algorithm and state its time complexity?

602


Can we overload final method in java?

544






What does t in java mean?

530


What are the differences between stringbuffer and stringbuilder?

536


What is meant by method overriding?

538


What is better - 'bit-shift a value' or 'multiply by 2'?

695


What is the use of beaninfo?

584


What are nested classes in java?

600


What is the difference between inner class and nested class?

548


What are thread groups?

567


Explain aggregation in java?

543


What is data string?

493