why the abstract class has default constructor?

Answer Posted / ranganathkini

A class has a constructor so that when an instance of the
class is created, the fields of the class can be setup to a
initial valid state.

Abstract classes define partial implementation of a public
contract. Which means that it may implement some of the
methods and contains partially implemented methods that are
marked abstract.

Since abstract classes can have partial implementation and
such partial implementation can include fields of the class,
a constructor becomes necessary so that those fields are
initialized to a valid default state when they are created
thru the constructor of their concrete subclasses.

Is This Answer Correct ?    12 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What will happen to the exception object after exception handling?

581


What is structure of java heap? What is perm gen space in heap?

546


Why do we use bufferedreader?

542


Difference between vector and arraylist.

585


What are the two ways of implementing multi-threading in java?

820






Can two objects have same hashcode?

566


what are three ways in which a thread can enter the waiting state? : Java thread

581


What is difference between iterator access and index access?

649


What are thread local variables?

557


How to sort an array in java without using sort method?

530


Is void a data type in java?

528


How do you declare an array that will hold more than 64KB of data?

648


Will the compiler creates a default constructor if I have a parameterized constructor in the class?

587


What is qualitative variable?

524


Highest level event class of the event-delegation model?

3507