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
Where we write javascript code in html page?
In which language java is written?
How do you pass by reference?
What comes to mind when someone mentions a shallow copy in java?
How do listeners work?
How do you print array in java?
What is consumer interface?
What does main method?
Can we able to pass objects as an arguments in java?
What advantage do java's layout managers provide over traditional windowing systems?
What methods are used in Servlet?Applet communication?
Explain about java sdk?
What is functional interface in java?
What are the loops in java?
How can we break singleton in java?