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
What will happen to the exception object after exception handling?
What is structure of java heap? What is perm gen space in heap?
Why do we use bufferedreader?
Difference between vector and arraylist.
What are the two ways of implementing multi-threading in java?
Can two objects have same hashcode?
what are three ways in which a thread can enter the waiting state? : Java thread
What is difference between iterator access and index access?
What are thread local variables?
How to sort an array in java without using sort method?
Is void a data type in java?
How do you declare an array that will hold more than 64KB of data?
Will the compiler creates a default constructor if I have a parameterized constructor in the class?
What is qualitative variable?
Highest level event class of the event-delegation model?