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 the difference between jvm and jre? What is an interface?

555


What is the Scope of Static Variable?

734


What is tochararray in java?

505


Can a class have an interface?

557


What is the difference between stream and buffer?

521






What is treemap in java?

556


What is multithreading and its advantages?

579


Can you declare an interface method static?

588


What is lexicographically smallest string?

607


What is final modifier?

560


Explain the public class modifier?

507


What are streams in java 8?

552


What is a java object and java application?

578


Under what conditions is an object’s finalize() method invoked by the garbage collector?

582


What is hashing principle in java?

555